# Identity transform to return second item in array

**URL:** <https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740>\
**Category:** SHF Discussion and Questions\
**Tags:** identity-security-cloud, transforms\
**Created:** [March 18, 2025, 7:41pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740 "2025-03-18T19:41:00Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaebates](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Shaebates](https://developer.sailpoint.com/discuss/u/Shaebates)\
**Post date:** [March 18, 2025, 7:41pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/1 "2025-03-18T19:41:00Z")

</div>

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:

```auto
                "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?

---

<div class="post-metadata">

**Author:** ![Shaebates](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Shaebates](https://developer.sailpoint.com/discuss/u/Shaebates)\
**Post date:** [March 18, 2025, 7:53pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/2 "2025-03-18T19:53:20Z")

</div>

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](https://documentation.sailpoint.com/connectors/saas/ceridiandayforcehcm/help/saas_connectivity/ceridian_dayforce_hcm/account_attributes.html#)

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.

---

<div class="post-metadata">

**Author:** ![sup3rmark](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sup3rmark/32/36229_2.png) [@sup3rmark](https://developer.sailpoint.com/discuss/u/sup3rmark)\
**Post date:** [March 18, 2025, 7:54pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/3 "2025-03-18T19:54:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Shaebates](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Shaebates](https://developer.sailpoint.com/discuss/u/Shaebates)\
**Post date:** [March 18, 2025, 7:56pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/4 "2025-03-18T19:56:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kdfreeman](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/kdfreeman/32/22737_2.png) [@kdfreeman](https://developer.sailpoint.com/discuss/u/kdfreeman)\
**Post date:** [March 18, 2025, 8:00pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/5 "2025-03-18T20:00:45Z")

</div>

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

> **[Identity Attribute Rule | SailPoint Developer Community](https://developer.sailpoint.com/docs/extensibility/rules/cloud-rules/identity-attribute-rule)**
>
> This rule calculates and returns an identity attribute for a specific identity.

---

<div class="post-metadata">

**Author:** ![suresh4iam](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/suresh4iam/32/29513_2.png) [@suresh4iam](https://developer.sailpoint.com/discuss/u/suresh4iam)\
**Post date:** [March 18, 2025, 8:28pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/6 "2025-03-18T20:28:55Z")

</div>

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

> **[Split | SailPoint Developer Community](https://developer.sailpoint.com/docs/extensibility/transforms/operations/split)**
>
> Return the Nth element of a split array.

---

<div class="post-metadata">

**Author:** ![Shaebates](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Shaebates](https://developer.sailpoint.com/discuss/u/Shaebates)\
**Post date:** [March 18, 2025, 9:03pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/7 "2025-03-18T21:03:28Z")

</div>

```auto
{
    "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?

---

<div class="post-metadata">

**Author:** ![KRM7](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/krm7/32/2685_2.png) [@KRM7](https://developer.sailpoint.com/discuss/u/KRM7)\
**Post date:** [March 18, 2025, 9:19pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/8 "2025-03-18T21:19:56Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![suresh4iam](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/suresh4iam/32/29513_2.png) [@suresh4iam](https://developer.sailpoint.com/discuss/u/suresh4iam)\
**Post date:** [March 19, 2025, 12:18pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/9 "2025-03-19T12:18:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Shaebates](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Shaebates](https://developer.sailpoint.com/discuss/u/Shaebates)\
**Post date:** [March 19, 2025, 1:58pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/10 "2025-03-19T13:58:52Z")

</div>

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

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/1/d/1daea14580c0ffa3b9bdf7fef96f3db104929ef3.png)

---

<div class="post-metadata">

**Author:** ![jsosa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jsosa/32/31578_2.png) [@jsosa](https://developer.sailpoint.com/discuss/u/jsosa)\
**Post date:** [March 19, 2025, 2:06pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/11 "2025-03-19T14:06:38Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![KRM7](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/krm7/32/2685_2.png) [@KRM7](https://developer.sailpoint.com/discuss/u/KRM7)\
**Post date:** [March 19, 2025, 2:25pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/12 "2025-03-19T14:25:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tulasi](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/tulasi/32/34596_2.png) [@Tulasi](https://developer.sailpoint.com/discuss/u/Tulasi)\
**Post date:** [March 19, 2025, 2:26pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/13 "2025-03-19T14:26:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shaebates](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Shaebates](https://developer.sailpoint.com/discuss/u/Shaebates)\
**Post date:** [March 19, 2025, 2:55pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/14 "2025-03-19T14:55:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KRM7](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/krm7/32/2685_2.png) [@KRM7](https://developer.sailpoint.com/discuss/u/KRM7)\
**Post date:** [March 19, 2025, 6:17pm UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/15 "2025-03-19T18:17:05Z")

</div>

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.

```auto
{
"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

---

<div class="post-metadata">

**Author:** ![David\_Norris](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@David\_Norris](https://developer.sailpoint.com/discuss/u/David_Norris)\
**Post date:** [March 23, 2025, 5:19am UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/16 "2025-03-23T05:19:24Z")

</div>

Reference: [Identity Attribute Context in Transforms | SailPoint Developer Community](https://developer.sailpoint.com/docs/extensibility/transforms/guides/identity-context-examples/)

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [May 22, 2025, 5:19am UTC](https://developer.sailpoint.com/discuss/t/identity-transform-to-return-second-item-in-array/104740/17 "2025-05-22T05:19:47Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
