Mapping multi-value attribute (CN) from IDM to a single-value attribute in IG (workforceID)

Hi,

I implemented IG with IDM and I noticed a few warnings during collection of identities saying that the IG is trying to collect multiple values in a single value attribute workforceID. The reason is that some special IDM accounts have 2 CNs. The CN from IDM is mapped to workforceID in IG.

Do you have an example of a ECMAScript which can keep only the first value and strip others?

...Yes, I know that IG automatically takes only the first value and technically the collected identities look OK in IG. I just want to have the collections without warnings.

Milan

  • Verified Answer

    +1  

    This is actually tricker than I thought at first.   If there is only one value passed in, even if its from a multivalue attribute, it passes it in as a simple string.  If there is more than one value passed in, then it gives you a string, however its a json encoded array.    That's not fun.

    This example below will detect if it thinks its array (if the first char is a bracket '[') and then join all the values together.  If the first char isn't a bracket it just sends back the inputValue.

    In your case you could modify this to just set outputValue to the the jObject[0] value I think after the JSON.parse is finished.

    --Jim


    if(inputValue[0] == '[' && inputValue[1]== '"') {
        var result = '';
        var jObject = JSON.parse(inputValue);
        for (var content in jObject) {
            result += jObject[content] + ' ';
        }
        outputValue = result;
    } else {
        outputValue = inputValue;
    }

  • 0   in reply to   

    Also, I've used this snippet in the back to avoid the warning in the collection, but to give me feedback when a multivalue is still in there (usually after the app owner SWEARS that there aren't any, and they appear to want to clean them all up):

    if(inputValue[0] == '[') {
        outputValue = 'Multivalue detected';
    } else {
        outputValue = inputValue;
    }

  • 0 in reply to   

    Thank you! It helped me a lot.