firstValid Tranform issue

Hi,

The below transform was created two months back, and it has been working fine all these days; today, I am getting the below error. Any idea?

There was an exception while calculating the value for this attribute. Error rendering template: $guid.substring(0,$guid.indexOf(β€œ@”))

{
   
    "name": "MailAliasWorkdayEmail",
    "type": "static",
    "attributes": {
        "value": "#if($bsf.length() > 0)$bsf #elseif($nerm.length() > 0)$nerm #elseif($workdayEmailAlias != \"NONE\")$workdayEmailAlias#elseif($mailnickname != \"NONE\")$mailnickname#end",
        "bsf": {
            "type": "static",
            "attributes": {
                "value": "$guid.substring(0,$guid.indexOf(\"@\"))",
                "guid": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "type": "accountAttribute",
                                "attributes": {
                                    "sourceName": "Workday FF",
                                    "attributeName": "EMAIL_ADDRESS_WORK"
                                }
                            },
                            "@none.com"
                        ]
                    }
                }
            }
        },
        "nerm": {
            "type": "static",
            "attributes": {
                "value": "$guid.substring(0,$guid.indexOf(\"@\"))",
                "guid": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "type": "accountAttribute",
                                "attributes": {
                                    "sourceName": "NERM",
                                    "attributeName": "u_network_email_address"
                                }
                            },
                            "NONE"
                        ]
                    }
                }
            }
        },
        "workdayEmailAlias": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "name": "workdayEmailAlias"
                        },
                        "type": "identityAttribute"
                    },
                    "NONE"
                ]
            }
        },
        "mailnickname": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "sourceName": "Active Directory",
                            "attributeName": "mailNickname"
                        }
                    },
                    "NONE"
                ]
            }
        }
    },
    "internal": false
}

are these always returning a string with β€œ@” in it, unless it’s an empty string?

Seems to be like a data issue. You can check if the system is still sending you same data as before or something changed. If any changes, you need to modify your transform accordingly.

1 Like

@pkumar22 Hello,

In bsf variable when didn’t find the account attribute return β€œ@none” but at the nerm just return β€œnone” and the velocity search for @.

Did you tried to put the @ in the return?

Let me know if works!

I tried, but still had the same error.

   "nerm": {
            "type": "static",
            "attributes": {
                "value": "$guid.substring(0,$guid.indexOf(\"@\"))",
                "guid": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "type": "accountAttribute",
                                "attributes": {
                                    "sourceName": "NERM",
                                    "attributeName": "u_network_email_address"
                                }
                            },
                            "@none.com"
                        ]
                    }
                }
            }
        }

hey @pkumar22 , try this :

{
   
    "name": "MailAliasWorkdayEmail",
    "type": "static",
    "attributes": {
        "value": "#if($bsf.length() > 0)$bsf #elseif($nerm.length() > 0)$nerm #elseif($workdayEmailAlias != \"NONE\")$workdayEmailAlias#elseif($mailnickname != \"NONE\")$mailnickname#end",
        
        "bsf": {
            "type": "substring",
            "attributes": {
                "begin": 0,
                 "end": {
                     "type": "indexOf",
                     "attributes": {
                         "substring": "@",
                         "input":{
                            "type": "firstValid",
                            "attributes": {
                                "values": [
                                    {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "sourceName": "Workday FF",
                                            "attributeName": "EMAIL_ADDRESS_WORK"
                                        }
                                    },
                                    "@none.com"
                                ]
                            }
                        }
                     }
                 }
            }
        },
        "nerm": {
            "type": "substring",
            "attributes": {
                "begin": 0,
                 "end": {
                     "type": "indexOf",
                     "attributes": {
                         "substring": "@",
                         "input":{
                            "type": "firstValid",
                            "attributes": {
                                "values": [
                                    {
                                        "type": "accountAttribute",
                                        "attributes": {
                                            "sourceName": "Workday FF",
                                            "attributeName": "EMAIL_ADDRESS_WORK"
                                        }
                                    },
                                    "@none.com"
                                ]
                            }
                        }
                     }
                 }
            }
        },
        "workdayEmailAlias": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "name": "workdayEmailAlias"
                        },
                        "type": "identityAttribute"
                    },
                    "NONE"
                ]
            }
        },
        "mailnickname": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "sourceName": "Active Directory",
                            "attributeName": "mailNickname"
                        }
                    },
                    "NONE"
                ]
            }
        }
    },
    "internal": false
}

You can try this:

{
    "id": "123321",
    "name": "Teste-EmailAlias",
    "type": "static",
    "attributes": {
        "bsf": {
            "type": "split",
            "attributes": {
                "delimiter": "@",
                "index": 0,
                "input": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "type": "accountAttribute",
                                "attributes": {
                                    "sourceName": "Workday FF",
                                    "attributeName": "EMAIL_ADDRESS_WORK"
                                }
                            },
                            "[email protected]"
                        ]
                    }
                }
            }
        },
        "nerm": {
            "type": "split",
            "attributes": {
                "delimiter": "@",
                "index": 0,
                "input": {
                    "type": "firstValid",
                    "attributes": {
                        "values": [
                            {
                                "type": "accountAttribute",
                                "attributes": {
                                    "sourceName": "NERM",
                                    "attributeName": "u_network_email_address"
                                }
                            },
                            "[email protected]"
                        ]
                    }
                }
            }
        },
        "workdayEmailAlias": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "name": "workdayEmailAlias"
                        },
                        "type": "identityAttribute"
                    },
                    "NONE"
                ]
            }
        },
        "mailnickname": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "type": "accountAttribute",
                        "attributes": {
                            "sourceName": "Active Directory",
                            "attributeName": "mailNickname"
                        }
                    },
                    "NONE"
                ]
            }
        },
        "value": "#if($bsf != \"none\")$bsf#elseif($nerm != \"none\")$nerm#elseif($workdayEmailAlias != \"NONE\")$workdayEmailAlias#elseif($mailnickname != \"NONE\")$mailnickname#end"
    },
    "internal": false
}

Let me know if works!