Help with empty values in transform

I am creating a transform that will only populate the phone number identity attribute if the user is not in Germany. I am doing a comparison with a conditional type and it works fine if the phone number account attribute contains a value. However it fails if the phone number is empty.

To get around this, I added added firstValid check to see if the account attribute contains a value and add a value of “NONE” if it doesn’t. However, this returns the following value:

{attributes={input=com.sailpoint.seaspray.transform.FirstValidTransform@616710f4}}

Can anybody help advise where I am going wrong?

{

"name": "Remove Germany from Phone Number",

"type": "conditional",

"attributes": {

    "expression": "$country eq Germany",

    "positiveCondition": "$noPhoneNumber",

    "negativeCondition": "$phoneNumber",

    "country": {

        "attributes": {

            "sourceName": "Mark Test",

            "attributeName": "u_country"

        },

        "type": "accountAttribute"

    },

    "noPhoneNumber": {

        "attributes": {

            "value": "Germany"

        },

        "type": "static"

    },

    "phoneNumber": {

        "attributes": {

            "input": {

                "type": "firstValid",

                "attributes": {

                    "values": \[

                        {

                            "attributes": {

                                "sourceName": "Mark Test",

                                "attributeName": "u_phone_number"

                            },

                            "type": "accountAttribute"

                        },

                        {

                            "attributes": {

                                "value": "NONE"

                            },

                            "type": "static"

                        }

                    \]

                }

            }

        }

    }

},

"internal": **false**

}

Remove the \ next to the square braces and the ** from false

your transform should look something like this:

{
    "id": "REMOVED",
    "name": "ADWDSZ - findEmail",
    "type": "firstValid",
    "attributes": {
        "values": [
            {
                "attributes": {
                    "attributeName": "mail",
                    "sourceName": "Active Directory"
                },
                "type": "accountAttribute"
            },
            {
                "attributes": {
                    "attributeName": "EMAIL_ADDRESS_WORK",
                    "sourceName": "Workday Production Sandbox"
                },
                "type": "accountAttribute"
            },
            {
                "attributes": {
                    "attributeName": "personal_email",
                    "sourceName": "SecZetta"
                },
                "type": "accountAttribute"
            },
            {
                "attributes": {
                    "attributeName": "personal_email",
                    "sourceName": "SecZetta"
                },
                "type": "accountAttribute"
            },
            {
                "attributes": {
                    "attributeName": "email",
                    "sourceName": "ServiceNow - SSMHCTEST"
                },
                "type": "accountAttribute"
            },
            {
                "attributes": {
                    "value": "noemail@noemail.com"
                },
                "type": "static"
            }
        ]
    },
    "internal": false
}

Hi @lawleym , I tried restructuring the transform.
could you take a look ?

{

"name":"Remove Germany from Phone Number",

"type":"static",

"attributes":{

    

    "value":"#if($country == 'Germany')#else $phonenumber #end",

    "country":{

    

            "attributes": {

        "sourceName": "Mark Test",

        "attributeName": "u_country"

    },

    "type": "accountAttribute"

    },

    "phonenumber":{

    

        "attributes":{

        

            "values":\[

            

                {

                        "attributes": {

                            "sourceName": "Mark Test",

                            "attributeName": "u_phone_number"

                        },

                        "type": "accountAttribute"

                    },

                 {

                        "attributes": {

                            "value": "NONE"

                        },

                        "type": "static"

                    }

            

            \]

        

        },

        "type":"firstValid"

    

    }





}

}

Thank you both for your solutions. It is now working

1 Like

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