Dynamic Values in Send Email - Workflow

Hi All,
Did anyone know how to use dynamic values in Workflow. I have refered the below link but not get the detailed info.

Pls share if you try this.

Thanks.

Hi @Santhakumar ,

Can you elaborate more on the use case ?

The email body is Send Email in a workflow uses HTML, so you can use HTML if and else to populate the dynamic values in the email body.

HTH

@shaileeM I need to send the email based on the department so i have tried inserting if else in email body but it throws me an 400 bad request.

Any idea how to get this or am i making any mistake?

Thanks.

You can use velocity to have if and else statements on the email step like this :
For example
#if($!oldLastName)\n Old LastName: ${oldLastName}
#end

This would only print if the variable has a value. you can do complex things :slight_smile:

Hey @Santhakumar Did you set the context as well?

Example Email template body :

Greetings ${firstname}, ${lastname},

We are pleased to inform you that your MFA Account on XYZ application has been successfully created.
Email : ${email}
Username : ${uid}

CONTEXT:

Context here basically means that whatever variables that you are using in the body, how will they be evaluated?
So we define that in context saying if $email is the variable what information/data will it store. So we are giving the JSON path of the value that it should put in $email

Ex:

"email.$":"$.getIdentity.attributes.email"

Here, it basically means that, email will be the name of the variable that you are going to use in the template. and for the respective value, we are saying tha t goto action-> getIdentity-> attributes->email and store that in this variable.

{"email.$":"$.getIdentity.attributes.email","firstname.$":"$.getIdentity.attributes.firstname","lastname.$":"$.getIdentity.attributes.lastname","uid.$":"$.getIdentity.attributes.uid"}

Refer: Actions - SailPoint Identity Services for more information.

Hope this helps.

1 Like

@neeraj99 Thanks for the input will check this and let you know if works.

Sure, FYI for every variable that you are trying to use in the send-email action you need to define it in the context.

2 Likes

Hi @Santhakumar ,

Yes agree with @neeraj99 . You will need to declare the variables in the templating context so that you can use them in the email body.

Thanks,
Shailee

@shaileeM and @neeraj99 Agreed already added the context and try the if else condition in email body its working fine. Thanks for the input.

Thanks,
Shantha Kumar

1 Like