adamian
(Andrei Damian Fekete)
April 26, 2024, 2:05pm
1
Hi all,
I want to send an email using the workflow. Not all identity attributes may be set, and I want them to be displayed as empty string in the e-mail if they are not set.
Body of e-mail: ${title} ${titlex}
Templating Context:
{
"title.$":"$.getJoinerIdentity.attributes[?(@.title)].title",
"titlex.$":"$.getJoinerIdentity.attributes.title"
}
The input.body.context for the Send Email step as visible in the “Text Execution”:
E-mail Result: ${title} {$titlex}
Expected e-mail result:
I am sure I’m missing something obvious on how to solve this issue.
Best regards,
Andrei
Shanmukh
(Shanmukh Gali)
April 26, 2024, 2:59pm
2
Hi @adamian ,
In the email body of your “send email” workflow step, you can use velocity script’s if-else condition.
For example: if you want to check when string value is not null #if(${title}) ${title} ${titlex} #else (your else condition if any) #end
If you want to check when string is null #if(!${title}) ${title} ${titlex} #else (your else condition if any) #end
Hope this works for you.
Thank you.
Shanmukh Gali
3 Likes
I think @Shanmukh has the correct answer here. The workflow email step supports apache velocity similar to how email templates do.
adamian
(Andrei Damian Fekete)
April 29, 2024, 6:53am
4
Thanks @Shanmukh , I’ll try this this works (with both title
and titlex
).
This doesn’t work in the static
transform (which also uses Apache Velocity), so I didn’t think this could work here.