transform_scripts
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| transform_scripts [12/30/2024 06:54] – johnsonjohn | transform_scripts [12/31/2025 05:42] (current) – removed johnsonjohn | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | =====Transform Scripts===== | ||
| - | ---- | ||
| - | ====LDAP Transform ==== | ||
| - | < | ||
| - | //JWJ0215 2022 | ||
| - | // The manager coming in from LDAP is the DN value for the manager. | ||
| - | // The line of code below will locate the manager that matches the | ||
| - | // DN value and set it into the target record. To ignore the manager | ||
| - | // from LDAP, remove or comment out the line: ldapUtils.setManager(source, | ||
| - | // | ||
| - | // NOTE: The ' | ||
| - | // if the manager is brought in through an LDAP import. | ||
| - | // here and in the ' | ||
| - | ldapUtils.setManager(source, | ||
| - | |||
| - | // Set the source LDAP server into the target record | ||
| - | target.ldap_server = source.sys_import_set.data_source.ldap_target.server; | ||
| - | |||
| - | // Set the u_manager_status boolean | ||
| - | if (source.u_extensionattribute11 == ' | ||
| - | target.u_manager_status = true; | ||
| - | } else { | ||
| - | target.u_manager_status = false; | ||
| - | } | ||
| - | </ | ||
| - | ----- | ||
| - | |||
| - | ====Example==== | ||
| - | < | ||
| - | (function transformRow(source, | ||
| - | |||
| - | //Set Last Refreshed On Date to Help Mark Active Groups | ||
| - | target.u_last_refreshed_on = gs.nowDateTime(); | ||
| - | target.u_active = true; | ||
| - | |||
| - | //Convert source timestamp to GlideDateTime | ||
| - | target.u_group_created = new ymdLDAP().convertFrom(source.u_whencreated); | ||
| - | target.u_group_changed = new ymdLDAP().convertFrom(source.u_whenchanged); | ||
| - | |||
| - | //Check if the group is distribution or security | ||
| - | var regexDist = new RegExp(/ | ||
| - | var regexSNow = new RegExp(/ | ||
| - | var regexGal = new RegExp(/ | ||
| - | var regexSec1 = new RegExp(/ | ||
| - | var regexSec2 = new RegExp(/ | ||
| - | var regexSec3 = new RegExp(/ | ||
| - | var regexAdmin1 = new RegExp(/ | ||
| - | var regexAdmin2 = new RegExp(/ | ||
| - | var regexAdmin3 = new RegExp(/ | ||
| - | |||
| - | if (regexDist.test(source.u_distinguishedname)) { | ||
| - | target.u_group_type = ' | ||
| - | } else if (regexGal.test(source.u_distinguishedname)) { | ||
| - | target.u_group_type = ' | ||
| - | } else if ((regexSec1.test(source.u_distinguishedname)) || (regexSec2.test(source.u_distinguishedname)) || (regexSec3.test(source.u_distinguishedname))) { | ||
| - | target.u_group_type = ' | ||
| - | } else if (regexSNow.test(source.u_distinguishedname)) { | ||
| - | target.u_group_type = ' | ||
| - | } else if ((regexAdmin1.test(source.u_distinguishedname)) || (regexAdmin2.test(source.u_distinguishedname)) || (regexAdmin3.test(source.u_distinguishedname))) { | ||
| - | target.u_group_type = ' | ||
| - | } | ||
| - | |||
| - | })(source, target, map, log, action===" | ||
| - | </ | ||
| - | ---- | ||
transform_scripts.1735570459.txt.gz · Last modified: by johnsonjohn
