Help with Static Transform: Validating presence of Attribute to return Boolean

I am working on a requirement in IdentityNow where I need to check if a specific attribute (userTermDate) has a value.

If the attribute has a value, the result should be true.
If the attribute is empty/null, the result should be false.

I have drafted a Static Transform using firstValid to handle nulls and a Velocity #if statement for the logic. I’d like to get some feedback on whether this is the most robust way to handle this, or if there are better ways to handle empty strings versus nulls.

{

    "name": "TRF_HasTermDate_Troyv1",

    "type": "static",

    "attributes": {

        "hasTermDate": {

            "type": "firstValid",

            "attributes": {

                "values": [

                    {

                        "type": "accountAttribute",

                        "attributes": {

                            "sourceName": "workday test",

                            "attributeName": "userTermDate"

                        }

                    },

                    "empty"

                ],

                "ignoreErrors": false

            }

        },

        "value": "#if($hasTermDate=='empty')false#{else}true#end"

    },

    "internal": false

}

tried to check the result in identity profile mappings preview, even though the identity has a userTermDate value, it still give false value to my Has Term Date attribute.

Any advice or improvements would be greatly appreciated!

Hi @testipona,
Please set “ignoreErrors” to true and verify whether the user has an account on the Workday test source and that the userTermDate account attribute contains a value.

2 Likes

Hi @UjjwalJain ,

It is now resolve. the userTermDate is not visible to workday but rather it’s a different attribute that must be set to the transform that I created.

Thanks for your help! :slight_smile: