# Transform error

**URL:** <https://developer.sailpoint.com/discuss/t/transform-error/103079>\
**Category:** SHF Discussion and Questions\
**Tags:** transforms, sailpoint-identity-security\
**Created:** [March 4, 2025, 2:10pm UTC](https://developer.sailpoint.com/discuss/t/transform-error/103079 "2025-03-04T14:10:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![l\_pulignano](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@l\_pulignano](https://developer.sailpoint.com/discuss/u/l_pulignano)\
**Post date:** [March 4, 2025, 2:10pm UTC](https://developer.sailpoint.com/discuss/t/transform-error/103079/1 "2025-03-04T14:10:21Z")

</div>

Hello,  
I wrote this transform:

```auto
{
    "name": "Transform - Username choice",
    "type": "static",
    "attributes": {
        "ignoreErrors": "true",
        "USER_NAME": {
            "attributes": {
                "sourceName": "HR Oracle HCM Cloud (Source)",
                "attributeName": "USER_NAME"
            },
            "type": "accountAttribute"
        },
        "PERSON_NUMBER": {
            "attributes": {
                "sourceName": "HR Oracle HCM Cloud (Source)",
                "attributeName": "PERSON_NUMBER"
            },
            "type": "accountAttribute"
        },
        "sAMAccountName": {
            "attributes": {
                "sourceName": "AD Tier 2 (Source)",
                "attributeName": "sAMAccountName"
            },
            "type": "accountAttribute"
        },
        "value": "#if(!$USER_NAME) #if(!$sAMAccountName) $PERSON_NUMBER #else $sAMAccountName #end #else $USER_NAME #end"
    }
}

```

But it gives me this error:

```auto
There was an exception while calculating the value for this attribute. Error during transformation for attribute: uid (Transform ID: Transform - Username choice) Cause: Error rendering template: #if(!$USER_NAME) $PERSON_NUMBER #else $USER_NAME #end

```

The problem is in the management of null values I think, because when the USER\_NAME attribute is null I get this error. Do you know to manage empty attributes? Thanks in advance

---

<div class="post-metadata">

**Author:** ![sidharth\_tarlapally](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sidharth_tarlapally/32/26178_2.png) [@sidharth\_tarlapally](https://developer.sailpoint.com/discuss/u/sidharth_tarlapally)\
**Post date:** [March 4, 2025, 2:16pm UTC](https://developer.sailpoint.com/discuss/t/transform-error/103079/2 "2025-03-04T14:16:29Z")

</div>

Hi @l_pulignano

Based on your information , error is occurred to due improper null check .  
We need to user First Valid Transform to encounter Null Checks .

This is a reference example which is also alternative of what you are trying to acheive:

```auto
{
  "attributes": {
    "values": [
      {
        "attributes": {
          "sourceName": "Active Directory",
          "attributeName": "sAMAccountName"
        },
        "type": "accountAttribute"
      },
      {
        "attributes": {
          "sourceName": "Okta",
          "attributeName": "login"
        },
        "type": "accountAttribute"
      },
      {
        "attributes": {
          "sourceName": "HR Source",
          "attributeName": "employeeID"
        },
        "type": "accountAttribute"
      }
    ]
  },
  "type": "firstValid",
  "name": "Test First Valid Transform"
}

```

Please refer the below for more understanding: [First Valid | SailPoint Developer Community](https://developer.sailpoint.com/docs/extensibility/transforms/operations/first-valid)

Hope this helps !  
Thanks 🙂

---

<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 4, 2025, 2:39pm UTC](https://developer.sailpoint.com/discuss/t/transform-error/103079/3 "2025-03-04T14:39:34Z")

</div>

Yes, as Sidharth mentioned,

You can use first valid Transform to fulfil your requirement.

For future use cases, where you need to use Static Transform, remember that, every attribute you define inside Static transform should have a value, if not it will throw an exception. So, you should use first valid type Transform for every attribute you declare inside Static Transform.

```auto
{
    "type": "static",
    "attributes": {
        "variable1": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "sourceName": "",
                            "attributeName": ""
                        }
                    },
                    "none"
                ]
            }
        },
        "variable2": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "sourceName": "",
                            "attributeName": ""
                        }
                    },
                    "none"
                ],
                "ignoreErrors": false
            }
        
        },
        "value": "#if($variable1 != 'none')do something#end"
    }
}

```

---

<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 3, 2025, 2:40pm UTC](https://developer.sailpoint.com/discuss/t/transform-error/103079/4 "2025-05-03T14:40:24Z")

</div>

Closed on May 3, 2025, 2:40pm UTC

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