Using Automation to set Reporter from Body

Hellen Braun June 15, 2023

Dear community,

I'm trying to change the reporter from a specific type of Tickets, but I'm having issues.

 

So the Ticket will be created with one generic JIRA account as reporter, and the goal is to setup the correct reporter based on the information we have in the Ticket description.

I've tried some command lines from the "Edit issue" , but I'm getting error message.

Ticket description:

Username: test01

 

Edit Issue script I tried:

{
"update":{
"reporter":{
"set";{{issue.description.match("(?i).*Username:\s*(.*)").asJsonObject("key")}}
}
}
}

 

Error message:

Edit issue

Error while parsing additional fields. Not valid JSON
Hope you can help me!

4 answers

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 15, 2023

Hi @Hellen Braun -- Welcome to the Atlassian Community!

Due to the GDPR changes for privacy, you can no longer use just the name to set a user field.  Instead you need the accountId value: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Single-user-picker-custom-field

Two possible work-arounds are to:

  • Call the REST API to gather the users, filter on the displayName, and use that to find the accountId for usage
  • Let's assume there are other issues assigned (or reported by) that person.  You could use Lookup Issues with JQL to search on the name, as Jira will convert that to the accountId.  For example, project = myProjectName AND reporter IN ("Bill Sheboy")  Then grab the accountId from the first matching issue for use, such as with {{lookupIssues.first.reporter.accountId}}

Kind regards,
Bill

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 15, 2023

Re: the REST API, it's a bit complicated, but do-able and documented here:

Like Bill Sheboy likes this
0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 19, 2023

Hi @Hellen Braun -- we should probably ask are you running on Jira Cloud or Server/Data Center?

If you are on Cloud, then what @Bill Sheboy points out is correct, and you CANNOT use a username (example: darryllee) to set the Reporter. You would need to follow the example I linked to, which is almost exactly what you are asking for:

If you're on Server/DC, you don't need to mess with looking up the accountId. The on-prem versions of Jira still allow usernames.

But in both cases, you don't have to mess with JSON at all! Once you get the username or user accountId, can use Smart values when editing the Reporter field, like so if you were using Server/DC, you could do this:

Screenshot 2023-06-19 at 1.21.48 AM.png

(I use a Manual trigger for testing.)

The way you add a Smart value is to start typing in that field, and then when you're finished, click on the pop-up option that shows up.

0 votes
Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2023

Deleted. Selected wrong place for answer.

Sorry.

0 votes
Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 15, 2023

Hi, @Hellen Braun 

Check please string with set. You wrote ; there, but must be :

Hellen Braun June 16, 2023

Made the change, now the error message is different:

 

com.codebarrel.automation.rule.error.action.additional.field.update.operations.invalid.execution
reporter
Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2023

Reporter, which you wanted to assign, has enough rights, to be assigned?

Hellen Braun June 16, 2023

Yes, Board is open to every loged user.

 

I'm using the user username, I also tried by email, same error message.

Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2023

Please, check,  that you can assign this user, try manually assign him.

Users can see board, but it's not a guarantee, that they can act as reporters.

And check please, that user, Actor, under whom rule is running, has enough rights to change reporter 

Hellen Braun June 16, 2023

The user, Actor, is Admin from this Board.

Also did the same process manually, it works.

 

I don't think is a lack of permission but something with the scripting, not sure about it.

Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2023

Hellen, why are you talking about Board? Do you mean Project?

 

If not, then Project is not Board, and user can be administrator of Board, but he won't have rights to change reporters in issues of projects.

Hellen Braun June 19, 2023

It's a project, but we use the Board to handle all issues.

The user Actor, is Admin from the Project. I was able to do changes manually with the same user.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events