I am trying to add source name in the access request reviewer email template but the code I tried is not working.Can anyone help with the exact working code for fetching the source name.
According to the docs (below), the sourceInformation variable should only be used with multiple accounts. Are you attempting this on a single account access request? Also, with your current setup, is your email sending with no data or are you failing to get an email sent at all?
Blockquote
Note: This should only be used in case of multiple accounts.
Your code looks fine. The $sourceInformation variable is documented for the Access Request Reviewer template, but it only populates when the identity has multiple accounts on the same source. If the identity has a single account per source (which is the common case), $sourceInformation will be null, so your #if block won’t render anything.
For single-account cases, I think there’s no built-in variable in this template that exposes the source name.
If you need source name for every request regardless of account count, you can try to handle it outside the email template: use a workflow triggered on Access Request Submitted, call the ISC APIs to resolve the source name from the requested item, and send a custom email via the Send Email action with whatever variables you need. That gives you full control over the payload.
If a workflow feels like overkill for this, a simpler option is to include the source name in your access profile or entitlement display names (e.g., “AD - Domain Admins”). That way the reviewer sees it in $requestedObjectName without any template changes.
I am trying to call v3/search api to fetch the source name using entitlement id
Here is the response from postman
[
{
“source”: {
“name”: “a******”,
“id”: “6*******************4a”
},
“type”: “entitlement”,
“_type”: “entitlement”,
“_index”: “202”,
“_score”: 12.889268
}
]
and call it in my custom email {{$.hTTPRequest.body[0].source.name}} this is not working
am I doing anything wrong here? Please correct
At first glance, the JSONPath expression you used looks correct.
Can you provide us your workflow or at least the configuration for the HTTP Request and Define Variable / Send Email that you’re referencing that variable in?
Your API response looks correct. I think the issue is how the value is being used in the custom email template. Instead of calling this directly in the email body:
{{$.hTTPRequest.body[0].source.name}}
Try passing the value first in the Send Email action under Templating Context:
Also please confirm the exact technical name of your HTTP Request step from the workflow execution history. If the step name is different, the JSONPath has to match that exact name.
Ah, it looks like the HTTP Request name hTTPRequest vs hTTPRequest3 was likely your initial issue. You can either reference the variable using {{}} in the body of the email or use the templating context like Harish mentioned.
I would try using a Define Variable step before your Send Email with the variable you’re trying to resolve in there. Once it’s set, during the execution you can see the output to ensure it’s resolving correctly and there’s not a reference issue.
The step name and templating context both look correct. The piece that might be worth checking is the actual body output from the hTTPRequest3 step in the workflow execution history, not the Postman response. Postman confirms the API works, but the workflow could be getting a different result at runtime if the entitlement ID in the search request body isn’t resolving properly.
If you expand the hTTPRequest3 step in the execution history and the body comes back as an empty array, that would explain why ${sourceName} renders blank.
If the body does show the expected response, one thing that could help isolate the issue is adding a Define Variable step between the HTTP Request and Send Email. Setting it to $.hTTPRequest3.body[0].source.name using the variable selector and passing that into the email instead would make it easier to see exactly where the value is dropping off.
I am trying to fetch the source name of the access request and trying to incorporated the source name in the email template in a workflow (Access Request Response/Access Request Submitted).
Thanks for providing that detail. Based off that, I think we’ve determined that the output from $.hTTPRequest3.body[0].source.name is null, so I would confirm that the output from your HTTP Request 3 Step is actually getting the correct data.
Like Harish already mentioned, it could be that a parameter that you’re using in your search API call is not resolving and is returning no results from your call. If you look at the output of your HTTP Request 3, what does it show? I’m guessing [], which indicates a variable that you’re passing into it or something is wrong with the API call.