Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Populate a user picker field from the description field

This workaround is meant to help JSM projects where it is necessary to pull someone mentioned in a text format from the description field into a user picker field, like the Reporter field.

At the moment, the lookup of a user picker field is by ID and not text. Therefore, the A4J will not be able to add the user account and the field will be "Anonymous".

Workaround steps:

  • Issue creation:

    Usually, anyone looking for this workaround is because they are using an automatic ticket creation method, for example, when a ticket is automatically created from a Slack channel, so you will need to have a default value in the Description field so that A4J can get the username, see below:

    "Please activate the offboarding process and ensure the account is terminated on the limited date. The owner of this account is xxxxxx."
    The automation rule will get the values that are after the "is" until the "dot".

     

  • Automation rule:
    • It will be necessary to create a variable, "username" for example with this smart value: {{description.match("The owner of this account is\s(.*)")}}Screen Shot 2022-09-14 at 16.51.27.png
    • It will be needed to create an API token for the Web Request process. The Web Request needs your credentials and an API token encoded with base64:Screen Shot 2022-09-14 at 16.55.52.png
       Note: the Get function of the Web Request to get a user account has some limitations. It will take the first option that appears in the search, so if you have two similar usernames, the last name must be entered.

      For more information about this procedure, please refer to the documentation below:

    • Add an edit action into the desired user picker field with this smart value: {{webResponse.body.first.accountid}}Screen Shot 2022-09-14 at 17.03.11.png
    •  Extra tip: if you want to mention the user in a comment, use the smart value: [~accountid:{{webResponse.body.first.accountid}}]Screen Shot 2022-09-14 at 17.11.11.png
  • For more information on how to configure these steps, please refer to the video below:

11 comments

Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2022

Awesome!

Like Bruno Altenhofen likes this
Elspeth Kelly October 11, 2022

This is an amazing workaround!
Thanks for sharing this @Bruno Altenhofen 

Like # people like this
Gabriele Cecco May 20, 2023

Very useful! Thanks @Bruno Altenhofen 

Janusz Bułakowski August 25, 2023

cheers for magicthegathering in the webhook address :)

siviani.madrigal September 11, 2023

@Bruno Altenhofen  

I have similar case but something is wrong and it is not working this workaround on my side.

I got a custom field Text format, user will fill it with email address or user name, based on that value the assignee field needs to be change every time the custom field is updated.

The web response is not retrieving any results, not sure what is wrong. Will appreciate your support!

krunoslav_majer October 19, 2023

Similiar issue as @siviani.madrigal 
I am pretty close to your automatino but a bit simpler. 

My issue is that I tried to get the username and when testing it in a rest client it works but the automation rule (although returning 200) has no body.

Any idea?

siviani.madrigal October 23, 2023

@krunoslav_majer I was able to resolve my issue, the problem I was having is in the API token encoded with base64. When I tried to encoded my API token with my email, I was leaving a space between email and API, and for that reason the space was creating a character and cause trouble in the authorization. 

Like krunoslav_majer likes this
krunoslav_majer November 14, 2023

@siviani.madrigal 

I also got it working after tickering around with the request. Can't even tell you what exactly the issue was 🤷‍♀️

Darren Boyle April 11, 2024

Thank you. We used this method to populate multiple users into the Approvers field from an Employee Object's custom field. This along with the For Each Branch made it possible. Thanks again.

Nico Harold
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2024

Figured it out!  I was misunderstanding the authorization part.

 

I cannot get this to work and have tried numerous variations.  I can tell I am getting a successful response as I have validated on an issue but I cannot seem to get anything back.  I do not understand why Jira does not update issue collectors to reconcile the email address provided against a JSM customer account to set the reporter.  The fact we have to use such a hacky workaround (that isn't even working for me) is ridiculous.  I've spent hours trying so many alternatives.

Has something changed where you can no longer search users with a name because of GDPR?  I've tried searching by the name, email address, etc...  I cannot get the webresponse back to a text field or a reporter when trying to get back the accountid.

Frédéric Thibert May 2, 2024

Hi,

Thank you very much for all your help in this topic, but I still don't understand the "Authorization" part.

 

You show to put "Basic" in your screenshot, but my webResponse.body is still empty, (the status is 200)

What is wrong ?

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events