Error during transformation for attribute

Hello Experts,

Could anyone tell me why I am receiving this error in following transform

{
    "id": "",
    "name": "Transform",
    "type": "static",
    "attributes": {
        "Personalemailaddress": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "sourceName": "HR",
                            "attributeName": "Personal email"
                        },
                        "type": "accountAttribute"
                    },
                    "-"
                ]
            },
            "type": "firstValid"
        },
        "secondaryEmail ": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "sourceName": "ABC",
                            "attributeName": "secondaryEmail"
                        },
                        "type": "accountAttribute"
                    },
                    "-"
                ]
            },
            "type": "firstValid"
        },
       "value": "#if($Personalemailaddress != 'NULL' && !$Personalemailaddress.isEmpty())$Personalemailaddress#{else}$secondaryEmail#end"
    },
    "internal": false
}

Thank you

I don’t think that you can catch ‘empty’ or null results that way.
try:

"value": "#if($Personalemailaddress = '-')$secondaryEmail#{else}$Personalemailaddress#end"

Hi @j1241,

For “Personalemailaddress” and “secondaryEmail”, I can you have used firstvalid operation. Want to know if you are trying to populate “-” if there are no values coming from source? In this case it should be like

"Personalemailaddress": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "sourceName": "HR",
                            "attributeName": "Personal email"
                        },
                        "type": "accountAttribute"
                    },
                    {
                        "attributes": {
                        "value": "-"
                        },
                   "type": "static"
                    }
                ]
            },
            "type": "firstValid"

Also, based on the condition given, it always be the “secondaryemail” value you will get as you are using first valid transform

"value": "#if($Personalemailaddress != 'NULL' && !$Personalemailaddress.isEmpty())$Personalemailaddress#{else}$secondaryEmail#end"

Hello @JackSparrow

This transform will calculate “Personal Email” value.

If “Personal Email” coming from HR-Source is empty or null the value of “Personal Email” should be populated by the value of “secondaryEmail” coming from “ABC” source.

If the value of “Personal Email” is coming from HR-Source it should stay.

If there is no value in both source it should be"-".

This is the transform I created,

{
    "id": "",
    "name": "TestStatic",
    "type": "static",
    "attributes": {
        "Personalemailaddress": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "sourceName": "HR",
                            "attributeName": "Personal email address"
                        },
                        "type": "accountAttribute"
                    },
                    {
                        "attributes": {
                            "value": "-"
                        },
                        "type": "static"
                    }
                ]
            },
            "type": "firstValid"
        },
        "secondaryEmail": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "sourceName": "ABC",
                            "attributeName": "secondaryEmail"
                        },
                        "type": "accountAttribute"
                    },
                    {
                        "attributes": {
                            "value": "-"
                        },
                        "type": "static"
                    }
                ]
            },
            "type": "firstValid"
        },
        "value": " " (Need help here to write a condition)
    },
    "internal": false
}

Hello Phil,

this condition throws the same error.

I believe the use-case here if Personalemailaddress exists then return the value otherwise return secondaryEmail .
It can be simply achieved by using firstValid transform instead static transfrom , it will also eliminate the need to writing velocity part of it.
See here for more detail: First Valid | SailPoint Developer Community

Hello @gourab

Initially I thought about it, But I couldn’t figure out how and where the condition should be applied if firstvalid type.

yes use-case here if Personalemailaddress exists then return the value otherwise return secondaryEmail

{
  "attributes": {
    "values": [
      {
        "Personal email address": {
          "sourceName": "HR Source",
          "attributeName": "Personal email address"
        },
        "type": "accountAttribute"
      },
      {
        "secondaryEmail": {
          "sourceName": "ABC",
          "attributeName": "secondaryEmail"
        },
        "type": "accountAttribute"
      },
      
    ]
  },
  "type": "firstValid",
  "name": "First Valid Transform"
}

Hi @j1241
FirstValid does not need any if else condition, it just returns 1st value if exists. This transform looks good to me. Just check once if it is working.

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