Workflow Email Templates Not Reading Variables

We have created a workflow that checks for identity attribute changes to users and when an attribute changes it filters on the persons role code and life cycle state. If either of those have changed and the user has a specific access profile, it has to send us an email informing us of the users change in status. This is an odd edge case but it’s basically there as a reminder to certify their need for a company phone if their role or life cycle state changes.

The workflow is working for the most part, but the variabled defining the user and their ID in the email are not working. I beleive it has something to do with not passing the context into the loop, but I have run into a wall on fixing it. I attempted to get the identity in the loop and to pass the context into the loop, but nothing I’ve tried has worked so far.

What is the basic fix for this? I feel like I’m so close, but I’m missing something obvious. How do I get the context to properly execute the variables in the email template?

"Loop Through Access Items": {
				"actionId": "sp:loop:iterator",
				"attributes": {
					"input.$": "$.getAccess.accessItems",
					"loopInput.$": "$.getAccess",
					"start": "Check for Cellphone Owner",
					"steps": {
						"Check for Cellphone Owner": {
							"actionId": "sp:compare-strings",
							"choiceList": [
								{
									"comparator": "StringEquals",
									"nextStep": "Send Certification Email",
									"variableA.$": "$.loop.loopInput.name",
									"variableB": "Cellphone Owner"
								}
							],
							"defaultStep": "End Loop Step",
							"displayName": "Check if Access Profile is Cellphone Owner",
							"type": "choice"
						},
						"End Loop Step": {
							"actionId": "sp:operator-success",
							"displayName": "End Loop",
							"type": "success"
						},
						"Send Certification Email": {
							"actionId": "sp:send-email",
							"attributes": {
								"body": "<p><!--ScriptorStartFragment--></p>\n<div class=\"scriptor-paragraph\">&lt;div&gt;</div>\n<div class=\"scriptor-paragraph\">&nbsp; A change to the following user&rsquo;s Lifecycle State or Primary Role Code has been detected.</div>\n<div class=\"scriptor-paragraph\">&nbsp; The user&rsquo;s cell phone possession should now be reviewed and certified.</div>\n<div class=\"scriptor-paragraph\">&lt;/div&gt;</div>\n<p>Name: {{displayName}}&nbsp;</p>\n<p>Employee ID: {{employeeId}}</p>\n<p>&nbsp;</p>",
								"context": {
									"displayName.$": "$.getIdentity.attributes.displayName",
									"employeeId.$": "$.getIdentity.attributes.identificationNumber"
								},
								"from": "no-reply@sailpoint.com",
								"recipientEmailList": [
									"Bilbo.Baggins@theshire.com"
								],
								"subject": "Cellphone Certification Required"
							},
							"displayName": "Send Certification Email",
							"nextStep": "End Loop Step",
							"type": "action",
							"versionNumber": 2

Hi @jared-fox !

For context I would try just passing the step name you need to read from to have all of the data available you may use, so in your case something like

$.getIdentity

Let me know if that helps!

Hey @jared-fox As @vkashat says, just pass the $.getIdentity in the context field and pass the variable inside the send email "Template Context’ field.

LMK if this helps.

Thanks
Shantha Kumar

Hey Shantha,

Thanks for the response, I tried that and got the same thing. Do I need to add a Get Identity step somewhere in the workflow? I’ve tried so much stuff I feel like it must be something simple I’m just overlooking.

Is it possible the error is here in the “Get Identity Access Profiles” and “Loop Through Access Items” steps? Do I need to somehow pass Access Item and other Identity logic into the loop?

Yes, you need to add Get Identity step inside the loop under the true condition and top of “Send Certification Email”.

In that case you would still need to pass some context to successfully get the identity, so you would need to pass $.trigger in order to use the identity ID from the identity attributes changed trigger, which would be something like:

{{$.trigger.identity.id}}

@jared-fox were you able to get this working?