# Replace All - Null error

**URL:** <https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773>\
**Category:** SHF Discussion and Questions\
**Tags:** identity-security-cloud\
**Created:** [December 15, 2025, 3:15pm UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773 "2025-12-15T15:15:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nidhipriya](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nidhipriya](https://developer.sailpoint.com/discuss/u/nidhipriya)\
**Post date:** [December 15, 2025, 3:15pm UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/1 "2025-12-15T15:15:49Z")

</div>

Hello all,

I’ve been working on a transform to determine the length of an identity attribute, which will help in making certain decisions. Below is the transform I used:  
I applied the `replaceAll` transform to remove any null spaces and then nested it with a `static` transform to calculate the number of characters without spaces

however it is giving null error as :  
There was an exception while calculating the value for this attribute. Error during transformation for attribute: adseed (Transform ID: ADseedsrinidhi) Cause: Error running identity attribute transform:java.lang.IllegalArgumentException: Value of ‘name’ cannot be null.

Can someone help on this?

{

```auto
"id": "XXXXX",

```

“name”: “XXXX”,

“type”: “replaceAll”,  
“attributes”: {  
“table”: {  
“\s+”: “”  
},  
“input”: {  
“type”: “static”,  
“firstname”: {  
“input”: {  
“attributes”: {  
“type”: “identityAttribute”,  
“attributes”: {  
“name”: “firstname”  
}  
},  
“lastname”: {  
“input”: {  
“type”: “identityAttribute”,  
“attributes”: {  
“name”: “lastname”  
}  
},  
“value”: “$firstname”  
}  
}  
}  
}  
},

---

<div class="post-metadata">

**Author:** ![ts\_fpatterson](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ts_fpatterson/32/26704_2.png) [@ts\_fpatterson](https://developer.sailpoint.com/discuss/u/ts_fpatterson)\
**Post date:** [December 15, 2025, 3:59pm UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/2 "2025-12-15T15:59:09Z")

</div>

From what I see, this will return a string, not the length.  
You must invert the structure. The static transform should be the outermost part of the transform. The static transform is used to execute a Velocity script

Here is an example of what may work, if I’m understanding your use case.

I’m curious as to your use case for needing the length. I have not tested this for you, it may need some additional refinement. My focus was on the order of the transform.

I’m curious as to the use case for needing the length. Are you looking at using it for a sAMAccountName, etc?

```auto
{
    "id": "Calculate-Length-Transform",
    "name": "Calculate Length Without Spaces",
    "type": "static",
    "attributes": {
        "inputName": {
            "type": "replaceAll",
            "attributes": {
                "table": {
                    "\\s+": ""
                },
                "input": {
                    "type": "static",
                    "attributes": {
                        "firstname": {
                            "type": "identityAttribute",
                            "attributes": {
                                "name": "firstname"
                            }
                        },
                        "lastname": {
                            "type": "identityAttribute",
                            "attributes": {
                                "name": "lastname"
                            }
                        },
                        "value": "$firstname$lastname"
                    }
                }
            }
        },
        "value": "$inputName.length()"
    }
}
```

---

<div class="post-metadata">

**Author:** ![nidhipriya](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nidhipriya](https://developer.sailpoint.com/discuss/u/nidhipriya)\
**Post date:** [December 15, 2025, 4:35pm UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/3 "2025-12-15T16:35:36Z")

</div>

@ts_fpatterson - Thanks for swift reply, but unfortunately this is not working giving same error There was an exception while calculating the value for this attribute. Error during transformation for attribute: adseed (Transform ID: ADseedsrinidhi) Cause: Error rendering template: $inputName.length()

scenario that i want to achieve is, if lastname character is less than 3 , i need to append lastname+firstname for samaccountname

---

<div class="post-metadata">

**Author:** ![ts\_fpatterson](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ts_fpatterson/32/26704_2.png) [@ts\_fpatterson](https://developer.sailpoint.com/discuss/u/ts_fpatterson)\
**Post date:** [December 15, 2025, 4:55pm UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/4 "2025-12-15T16:55:08Z")

</div>

check to see if you are dealing with a null value

#if($inputName)$inputName.length()#else0#end

You may want to do the same for $firstname and $lastname

---

<div class="post-metadata">

**Author:** ![UjjwalJain](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ujjwaljain/32/24704_2.png) [@UjjwalJain](https://developer.sailpoint.com/discuss/u/UjjwalJain)\
**Post date:** [December 18, 2025, 11:41am UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/5 "2025-12-18T11:41:06Z")

</div>

Hi @nidhipriya,

Can you try below transform once, it works fine for me.

```auto
{
"id": "Calculate-Length-Transform",

"name": "Calculate Length Without Spaces",

"type": "static",

"attributes": {

    "lastName": {

        "type": "replaceAll",

        "attributes": {

            "table": {

                "\\s+": ""

            },

            "input": {

                "type": "identityAttribute",

                "attributes": {

                    "name": "lastname"

                }

            }

        }

    },

    "firstName": {

        "type": "identityAttribute",

        "attributes": {

            "name": "firstname"

        }

    },

    "value": "#if($lastName.length() < 3)$lastName$firstName#{else}$lastName#end"

}

```

---

<div class="post-metadata">

**Author:** ![nidhipriya](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nidhipriya](https://developer.sailpoint.com/discuss/u/nidhipriya)\
**Post date:** [December 18, 2025, 11:54am UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/6 "2025-12-18T11:54:42Z")

</div>

@UjjwalJain - Thankyou!!  
I am able to correct the transform , its working according to my requirement.

---

<div class="post-metadata">

**Author:** ![UjjwalJain](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ujjwaljain/32/24704_2.png) [@UjjwalJain](https://developer.sailpoint.com/discuss/u/UjjwalJain)\
**Post date:** [December 18, 2025, 11:58am UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/7 "2025-12-18T11:58:11Z")

</div>

Great to hear the transform works for you!  
When you have a moment, please mark this post as solved.

---

<div class="post-metadata">

**Author:** ![nidhipriya](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@nidhipriya](https://developer.sailpoint.com/discuss/u/nidhipriya)\
**Post date:** [December 18, 2025, 12:01pm UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/8 "2025-12-18T12:01:09Z")

</div>

I mean, I was able to build the transform to meet my specific requirements.

---

<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:** [February 16, 2026, 12:01pm UTC](https://developer.sailpoint.com/discuss/t/replace-all-null-error/190773/9 "2026-02-16T12:01:23Z")

</div>

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