Identity transform to return second item in array

Hey folks! I’ve got another super easy transform question for you.

My HR authoritative source has an account attribute called “Organization Unit Name”, which is defined in the schema as multi-valued. It is displayed correctly in the employee’s account as having 4 values:

                "Organization Unit Name": [
                    "Company Name",
                    "Region",
                    "Location",
                    "Department"
                ],

In my Identity Profiles, I want to map this attribute, but only pull the second value, “Region”. I thought a Static transform with a value of “$Organization Unit Name[1]” would work to reference the array item, but I’m getting “Error Rendering Template”. I guess I could use a regex in a Replace transform instead, but I’m still hoping I can get it to work with this static reference.

Am I sort of on the right path here, or not at all?

I tried it without the spaces too, thinking that I was only seeing a Display Name instead of the technical name, but that didn’t change the error. The odd thing is that when I run the API in postman (at least, this is the one i was told the OOTB connector is using), I don’t get this value at all in my return. In the connector documentation though, this is what is stated:

Organization Unit Name

The name of the employee’s Organization Unit.

Technical Path: OrgUnitInfos.Items[?(@.OrgUnitDetail.IsPrimary ==true)].OrgUnitDetail.ShortName

I tried using OrgUnitDetail and OrgUnitInfos as well in the transform, but still no dice. I don’t think that is going in the right direction though.

Hey @Shaebates!

Transforms unfortunately can’t do anything with multi-valued attributes (other than reduce them to their first value, that is). Depending on the source type, your best bet here would probably be to add another Schema Attribute for Region, and the Organization Unit Name down to just the Region value via the appropriate xpath/jsonfilter.

1 Like

Ah darn. Thanks. Its a direct OOTB connector for Dayforce. I can’t edit those schemas.

You can go with cloud rules if transform is not able to do your task in this case.

You can use the split transform to get the value of second index

1 Like
{
    "id": "77f0d8ce-21a9-4318-b82c-b08d2a251b43",
    "name": "Region",
    "type": "split",
    "attributes": {
        "delimiter": ",",
        "index": 1,
        "throws": true
    },
    "internal": false
}

Oh interesting! I’ve never used this transform before. I’m getting this error though:

There was an exception while calculating the value for this attribute. Error during transformation for attribute: organization (Transform ID: Region) Cause: Split resulted in 1 items and you attempted to index at 1

Possibly because its a multi value attributes and not a single string like @sup3rmark was indicating?

1 Like

Try adding explicit input in your Split Transform, i.e declare the input as account attribute transform that reads your multi valued attribute.

None of the Transforms returns more than one value, that is the challenge here.

How many regions your org having, is it some limited number ?

Yes, you need to work it out one another way to achieve this like either made the account attribute as non multi-valued to get the value as a string or use identity attribute rule to pull the second value.

I thought the input was already explicit when I attach the transform to the Identity profile mapping? Did I understand that incorrectly?

I think ISC can not establish an order, because it should be stores as a set more than an ordered list or array.

Is that a web service source? If yes, you can develop a simple after operation rule, which iterates over the array, and returns the desired value (in the same attribute, or in a new separated one)

1 Like

This is an implict input. Better make it as a single valued attribute, then you can use Split Transform.

1 Like

I don’t now whether it works or not, why don’t you try a regex expression as the delimiter for the split transform, in the regex expression make sure that it ignores the square braces and use the comma as delimiter

Thanks for the great discussion everyone. I’ll try throwing a regex in there to see if I can get it to ignore the multi-value aspect, but ultimately, I think that since this is an OOTB connector and I don’t have control over the way the values are received by Sailpoint, my best option will be to use an Identity Attribute Rule, as mentioned by @kdfreeman.

For the benefit of others,

Transforms doesn’t support multi-valued attributes, it just returns any one value randomly out of the list of values. You can use below Transform which is equivalent to what you do in Rules.

{
"attributes": {
"value": "#foreach($link in $identity.getLinksByAppIdOrName("2c918088814e6a610181686b56977fa8",null))$link.getAttribute("Organization Unit Name")#end"
},
"type": "static",
"name": "Get Organization Static Transform"
}

This will result entire list of values, apply this transform as input to split or any other suitable Transform to get the data.

@Shaebates Glad that it helped you.

– Krish

Reference: Identity Attribute Context in Transforms | SailPoint Developer Community

Note that the link also provides an example of how to produce a comma separated list.

And also note the last “Notes” in the link…things get cast into a string the moment you put them into a variable in a transform…so you need to eval the list / array in a single evaluation before the cast occurs.