Converting displaynames to account id within Jira automation

Marc-Anton Weigelt December 28, 2023

Hello,

I would like to setup a Jira automation rule with a manual trigger plus user inputs which are used during further issue creations. The user inputs contain a firstname + lastname of a user which I need to get converted to an account id which I can then use in request participant fields.

How do I do that?

I have found already that post:
Solved: Jira Automation: Convert string containing user's ... (atlassian.com)
with that link:
The Jira Cloud platform REST API (atlassian.com)

but am afraid, that I do not understand how do use the Jira cloud reset api. So could maybe someone help me out with the actual code which I can paste for the described scenario into the automation steps?

Much apprieciated. :)

Regards,
Marc

1 answer

0 votes
Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 28, 2023

@Marc-Anton Weigelt 

It is safer and recommended that you use the email and not the user's first and last name in the API query.

But in summary what you should do is something like this:

- Every manual automation where the user enters a value creates an input variable for the field. In this field, users must use their email address instead of their first and last name.

- Then add a Send Web Request ACTION

  • URL: https://your-site.atlassian.net/rest/api/3/user/search?query={{user-input-variable}}
  • Method: GET
  • Check the box "Delay execution of subsequent rule actions until we've received a response for this web request"

- Not Mandatory, but interesting: Add an Audit Log action with this smartvalue: {{webResponse.body.accountId}}

This is the accountId of the user collected by your web response.

- Add an ACTION for EDIT Issue

  • Do not select any field. You must pass your value in the section additional fields. Your value must be like this one
{
"update": {
"customfield_10025": [
{
"add": {
"accountId": "{{webResponse.body.accountId}}"
}
}
]
}
}

Change the number (10025) for your custom field number.

Here an example print

Screenshot_164.png

Hope this helps you :)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events