Using Automation to set Reporter from Body
Asked by Hellen Braun:

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](https://jira.hrs.io/secure/AutomationProjectAdminAction!default.jspa?projectKey=ITSM#/rule/482/33702) {#toc-hId-237674755}

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


Answers:
author: Bill Sheboy
body: Hi [@Hellen Braun](/t5/user/viewprofilepage/user-id/5244372) -- 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

comments: author: Darryl Lee
body: Re: the REST API, it's a bit complicated, but do-able and documented here:

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


author: Darryl Lee
body: Hi [@Hellen Braun](/t5/user/viewprofilepage/user-id/5244372) -- we should probably ask are you running on Jira Cloud or Server/Data Center?

If you are on **Cloud** , then what [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) 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:

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

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](https://community.atlassian.com/t5/image/serverpage/image-id/263815i4EB4937A33808AF7/image-size/large?v=v2&px=999 "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.


author: Evgenii
body: Deleted. Selected wrong place for answer.

Sorry.


author: Evgenii
body: Hi, [@Hellen Braun](/t5/user/viewprofilepage/user-id/5244372)

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

comments: author: Hellen Braun
body: Made the change, now the error message is different:

com.codebarrel.automation.rule.error.action.additional.field.update.operations.invalid.execution  
reporter


author: Evgenii
body: Reporter, which you wanted to assign, has enough rights, to be assigned?


author: Hellen Braun
body: Yes, Board is open to every loged user.

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


author: Evgenii
body: 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


author: Hellen Braun
body: 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.


author: Evgenii
body: 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.


author: Hellen Braun
body: 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.