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

Populate a user picker field from the description field

Jh
Contributor
October 1, 2024

I've been trying to follow this article:

 

https://community.atlassian.com/t5/Jira-Service-Management-articles/Populate-a-user-picker-field-from-the-description-field/ba-p/2134905

I have not been successful. Here is what I have so far:

 

2024-10-01_12-32-32.jpeg

2024-10-01_12-32-43.jpeg

2024-10-01_12-34-00.jpeg

2 answers

1 accepted

0 votes
Answer accepted
Jh
Contributor
October 4, 2024

I changed the web request from EMPTY to Issue Data and it finally worked, so it seems the documentation was either for a different purpose or not correct.

2024-10-03_09-10-23.jpeg

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

Hello @Jh 

Based on this

Screenshot 2024-10-01 at 1.28.36 PM.png

...your issue's Description field literally contains the text

Worker's Manager |

You won't be able to extract a name from the Description field if the field doesn't contain the information.

Please provide an example of the text that you expect the Description field to contain.

Jh
Contributor
October 1, 2024

@Trudy Claspill 

I blurred it out but the log basically shows

Description: Worker's Manager | John Smith

I'd like for it to read the value after:

Worker's Manager | xxxx

OR


Proposed Manager | xxxx

The xxxx will always be a display name of a user

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

What are the details of your Create Variable step(s)?

Will the Description field always have both Worker's Manager and the Proposed Manager information, or just one or the other?

Can the Description contain any additional text after the name you are trying to extract?

Jh
Contributor
October 1, 2024

@Trudy Claspill 

Create Variable Name/Value

managerDisplayName
{{issue.description.match("(Worker’s Manager \| |Worker's Manager \| |Proposed Manager \| )([^\n\r]+)").group(2)}}

 Create Variable Name/Value

managerAccountId
{{webResponse.body.get(0).accountId}} 

 The description only has one or the other and does not have any other text other than the Display Name.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 1, 2024

Where are you getting the information about the use of the group() function appended to the match() function? Can you provide a link to your source? I could not find any mention of it in the documentation for manipulating text smart values.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/

Nor did I find it mentioned in the solution in the post you referenced.

Jh
Contributor
October 2, 2024

@Trudy Claspill 

group() function, I took from some examples I've found. Like: Example 

From what I thought, it captures all the text following the specified prefix until the end of the line.

match() function, I meant to use the smart value that matches either "Worker's Manager | " or "Proposed Manager | " and captures the text following it.

If this is the issue or if you have suggestions on how to handle it better, please let me know. I followed the link I mentioned to the T before but that did not work either.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 2, 2024

Do you have links to any examples showing group() being used? The one you provided does not do that.

Regardless, based on this:

The description only has one or the other and does not have any other text other than the Display Name.

...I believe you can simplify your Create Variable statement to use this instead:

{{issue.Description.substringAfter("|")}}

The substringAfter() function is documented here:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#substringAfter--String-separator-

Jh
Contributor
October 2, 2024

I tried that but unfortunately, same issue 

2024-10-02_13-27-59.jpeg

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 2, 2024

Please provide screen images showing your modified rule, and screen images showing the details of each step.

Jh
Contributor
October 2, 2024

 

2024-10-02_13-49-19.jpeg

2024-10-02_13-50-39.jpeg2024-10-02_13-52-26.jpeg2024-10-02_13-53-17.jpeg2024-10-02_13-53-33.jpeg

2024-10-02_13-53-50.jpeg

2024-10-02_13-54-06.jpeg2024-10-02_13-57-35.jpeg2024-10-02_13-54-19.jpeg2024-10-02_13-54-38.jpeg

2024-10-02_14-04-38.jpeg

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 2, 2024

Smart value field/variable names are case and spacing sensitive. In you Log action you have not used the exact same variable name that you used in your Create Variable action. The case of the "n" in "name" is not the same.

Screenshot 2024-10-02 at 3.41.27 PM.png

 

You have that same mismatch in your Send Web Request

Screenshot 2024-10-02 at 3.44.33 PM.png

Make sure all uses of the variable have the exact same case as the Name that you assigned to the variable and see if that changes the results.

Jh
Contributor
October 2, 2024

Ok, getting better results. Seems the web response isn't capturing anything for the query=

{{managerDisplayName.urlEncode}}

2024-10-02_15-55-35.jpeg

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 2, 2024

Have you confirmed manually that a user exist that actually has the displayName for which you are searching?

If the web response body is empty, that suggests no matches were found.

Jh
Contributor
October 3, 2024

Yes I have confirmed, I've tried many real display names of users in the description.

Jh
Contributor
October 3, 2024

It seems the issue is the web request showing empty. From the original post link I sent, others have had the same issue, although I followed the instructions on converting my API token to the format they suggested, ensuring no extra spaces or line breaks.

<EMAIL>:<API_TOKEN>

Jh
Contributor
October 3, 2024

I changed the web request from EMPTY to Issue Data and it finally worked, so it seems the documentation was either for a different purpose or not correct.

2024-10-03_09-10-23.jpeg

Like Trudy Claspill likes this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 3, 2024

That is great news!

If my responses helped you resolve your issue, please consider clicking the Accept Answer button to mark your Question as Solved. That helps others searching the community find posts with validated solutions.

You also have the option to create a new Answer on your post with the information about you learned above about the Web Request Body setting, and click Accept Answer on that.

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