Please be sure you’ve read the docs and API specs before asking for help. Also, please be sure you’ve searched the forum for your answer before you create a new topic.
I am creating a substring variable to capture the “FirstName LastName” that comes in the userDN of the identity. Need to display it in the email, when I execute the workflow I get $previousname instead of the value.
How are you referring to the variable? If you are using it for any comparison, you can refer to it using $.defineVariable.previousname
If you are using it in sending email, you can declare the Templating Context as below - {"variableA.$":"$.defineVariable.previousname"} and then use the VariableA in the email body or subject using ${variableA}
If not you cant use replace in your define variable.
Assuming you have dn like this : cn=firstname lastname,DC=test,DC=com
In define variable operator for your new variable previousname you can replace in sequence $.trigger.changes[?(@.attribute == "userdn")].oldValue
DC=test,DC=com by ,
cn= by ,
Note : in workflow i don’t know how to replace a value per empty. That’s why i purpose to replace by ,
in ouput you have ,firstname lastname,
you can then substring into a new variable for eleminating , or in your email template you can replace , per “” after define {“VariablePreviousname$”:“$.defineVariable.previousname”} as @shaileeM say.
for example in your template :
you can do : #set($newVariablePreviousName=$VariablePreviousname.replace(“,”,“”)).
Thanks @shaileeM this works. I realised I wasnt calling the variable correctly in the email. The issue I am stuck with currently is the length I am defining for the variable as it could be more than 20 characters. I only want to capture the “FirstName LastName” from the DN. Is there a better way?