Workflow - Templating Context of 'Send Email' Action

I want to include the oldValue and newValue of department changes from the triggered JSON payload into the email body saying e.g user has changed department from (oldValue) to (newValue).

I don’t know whether it’s possible to include the variables and JSON for these two values in the templating context of ‘Send Email’ action.

I tried a few combinations but without any luck.

For example {"oldDept.$":"$.trigger.changes.attribute.oldValue","newDept.$":"$.trigger.changes.attribute.newValue"}

Any suggestions on how to achieve this?

Thanks

Hi @nhassan,

Have you tried using the Define variable operator and using it inside the email.?

image

I would suggest you try it as below:

$.trigger.changes[?(@.attribute == “department”)].oldValue

This also seemed to work:

image

@jesvin90 and @sharvari you guys are amazing!!!

Thanks very much. Yes it worked.

@jesvin90 Thanks for the update.

I haven’t tried this but it seems also achievable by using Define Variable as you’ve mentioned.