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:

8 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 Bruno Altenhofen likes this
Atlassian 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 🤷‍♀️

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events