- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 08:28 AM
Hi,
This should be so simple but I'm getting nowhere with this.
I want to set a sys_user field to either true or false, based in the import found in the LDAP import. I have confirmed that u_extensionAttrbute3 contains the correct information, yet the following If statement does not work. I've exhausted every variant of the script that I can think of - removing the else statement, just using source.u_extensionAttribute3 instead of getValue, putting the script in an onBefore script. etc.Just saying "return true" or "return false" works, so it's the IF statement that's the issue.
Any thoughts anyone?
Many thanks,
Mark.
answer = (function transformEntry(source) {
if (source.getValue('u_extensionAttribute3') == 'abc') {
return true;
}
else
{
return false;
}
})(source);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 09:02 AM
For use as a Transform Script it would look something like this onBefore example:
/* onBefore Transform Script to handle all mappings, just map coalesce fields then add this */
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var getAtt3 = source.u_extensionAttribute3;
if (getAtt3 == 'ABC') {
target.<your output field> = true;
} else {
target.<your output field> = false;
}
})(source, map, log, target);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 08:54 AM
Hi
It seems fine. Can you try this one.
answer = (function transformEntry(source) {
if (source.getValue('u_extensionAttribute3') == 'abc') {
answer = true;
}
else
{
answer = false;
}
})(source);
Mark Correct or Helpful if it helps.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 09:02 AM
For use as a Transform Script it would look something like this onBefore example:
/* onBefore Transform Script to handle all mappings, just map coalesce fields then add this */
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var getAtt3 = source.u_extensionAttribute3;
if (getAtt3 == 'ABC') {
target.<your output field> = true;
} else {
target.<your output field> = false;
}
})(source, map, log, target);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 03:40 PM
Thank you! The On Before transform script did the job. Oddly the field map script still wouldn't play ball.