ISC Workflow: Conditional Recipient Email List in Send Email Action

Scenario: Email should be sent to respective helpdesk based on the user’s upn domain value when provisioning completed. Apart from the helpdesk email in recipient list, everything is same.

Issue in Workflow:
Action - Send Email: I’m looking to add recipient email address based on a upn value of a provisioned identity and it is a combination of static, dynamic and conditional email list. This works well when I include static and dynamic email combinations. Now, I’m trying to implement conditional recipient email list something like below.

“recipientEmailList”: [
“{{$.getIdentity1.attributes.upn}}”,
[email protected]”,
#if($.getIdentity1.attributes.upn.contains("domainA"))[email protected]#{else}[email protected]#end”
]

But it is giving me the parsing error on the Send Email action and also emptying the recipient list.
If I remove the if condition, then it works fine with static and dynamic values. So, I would like to know whether anybody tried the conditional operations in recipient list?

Alternate options:

  • I’m thinking to use Define Variable operator and set the email value on it based on UPN and refer it in the Send Email action.
  • Or using multiple Compare operator to set the recipient list.

I am not sure if this will work, but try with entire #if#end inside {{}}

I have tried it and returns the same parsing error.

I have tried all the possible Velocity conditions in the email list, but it provides me the same error.

So, I have used multiple compare operators and send email actions for each comparison to handle this use case.

You might be better off creating a variable before the email step that uses velocity to parse that data and store it, then just pass the variable into the email step

I have tried it and the challenge was to parse the data in the define variable operator where I couldn’t dynamically calculate the domain values and use the conditions based on domain value to set the email.

Hi Suresh,

You may use the compare string operator before the email send to see whether the upn contains domain A or not if it contains domain A send the email to below list.
recipientEmailList”: [
“{{$.getIdentity1.attributes.upn}}”,
[email protected]”,
[email protected]
]

If the compare strings go to false condition then use the below format for email action.
recipientEmailList”: [
“{{$.getIdentity1.attributes.upn}}”,
[email protected]”,
[email protected]
]

HTH.

1 Like

That is one of the alternate option I have mentioned in my post and I have chosen it in my current implementation. Here I’m trying to find more efficient way by setting the dynamic recipient value since the Email action is same for all process.

hi,
Should it not be (‘domainA’) rather than (“domainA”)

None of my .contain variables use double quotes unless they are escaped first.
ie ("domainA")

Hi Phil, I did try it and it gives me the same parsing error, seems like the if condition is not supporting on the recipient field in Send Email action or IDK I’m missing something here. It will be great if you have any workable code snippet which I can refer it.

I think the if condition is not supported on the Email action as far as i know and i also look into the documents.

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