LDAP Transform Script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 07:48 AM
Hello,
I am attempting to use a transform script to set the company field. I have verified I am getting the correct data through use of gs.log statements, but the value is not being filled in on the company field in the sys_user table. I am thinking it could be due to the company field being a reference field. The script is looking at company and co attributes in AD then determining the SN company based on those attributes. Any thoughts?
(function transformEntry(source) {
gs.log('Company Script started');
var xformedComp = '';
var adCompany = source.u_company;
var countryCode = source.u_co;
gs.log('Company: ' + adCompany);
gs.log('Country Code: ' + countryCode);
if (adCompany === 'Company 1') {
xformedComp = 'Company 1';
} else if (adCompany === 'Company 2' && countryCode === 'Country 1') {
xformedComp = 'Company 3';
} else if (adCompany === 'Company 2' && countryCode === 'Country 2') {
xformedComp = 'Company 4';
} else if (adCompany === 'Company 5' || (adCompany === 'Company 2' && countryCode === 'Country 3')) {
xformedComp = 'Company 5';
} else {
xformedComp = 'Company 6'; // default response to catch edge cases
}
gs.log('xformed company is: ' + xformedComp);
return xformedComp;
})(source);
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 08:00 AM
Looks like your missing answer = in line one. See example below.
answer = (function transformEntry(source) {
// init integration util
var integrationUtil = new HMIntegrationUtil();
var sizeBytes = null;
if(!gs.nil(source.u_sizegb))
sizeBytes = integrationUtil.convertDiskGBToBytes(source.u_sizegb);
return sizeBytes;
})(source);