I have a convoluted setup where one automation triggers a webhook that in turn triggers a second automation. On the second automation I am thus unable to use {{initiator.displayName}} to display who originally caused the chain of events.
What I was able to do is capture the initiator in the first automation and pass it forward via the webhook as a value called initiator. I can then use {{webhookData.initiator}} to access that accountId on the second automation.
{
"issues": [
"{{issue.key}}"
],
"initiator": "{{initiator}}"
}
If I add this value to a user picker, it works fine, but I want to use it in the body of an email.
I tried this:
{{webhookData.initiator.displayName}} has requested approval for {{issue.key}}.
But the result was:
has requested approval for CM-1.
If I don't use displayName, it returns the accountId.
Any suggestions for getting a first and last name as text from this variable?
Hi @Brock Jolet
Since GDPR, I believe you would need to use the accountId value, call the REST API to get user, and then use the response provided display name:
https://docs.atlassian.com/software/jira/docs/api/REST/1000.824.0/#api/2/user-getUser
As an alternative...you could take a chance the accountId is always associated to at least one issue in the project, and then use a JQL query with the ID value (e.g. with a branch or lookup issues), then get display name.
Kind regards,
Bill
Thanks, Bill.
I ran some tests and I believe this would work, but I ended up creating a custom field and just populating it with the initiator along the way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good idea, as that will be faster than calling the REST API to get it. If you want to "hide" that value so it is less likely to be tampered with in the custom field, consider adding it as an entity property instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.