Struggling with simple If statement in an LDAP transform map

Mark Van Loock
Tera Guru

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);

 

 

 

1 ACCEPTED SOLUTION

Ian Mildon
Tera Guru

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);

View solution in original post

3 REPLIES 3

Yousaf
Giga Sage

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.***

Ian Mildon
Tera Guru

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 Van Loock
Tera Guru

Thank you! The On Before transform script did the job. Oddly the field map script still wouldn't play ball.