Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,801
Community Members
 
Community Events
168
Community Groups

Change Reporter using Automation

Edited

Overview

I'm using a Jira Cloud app (Relay Intake Forms) to create rich external forms to submit to my Service Desk. 

Issue

One of the downsides of that app seems to be no field mapping for reporter. So all issues created via the form are from a single app-created user. 

I obviously want my users to be able to access the issues they created, so I need to change the Reporter to who is actually submitting these forms.

Failed Resolution

I created a custom field for "user email".  I'd like to create an automation that upon issue creation, changes the reporter to the contents of the custom field "user email".

I'm not too hip to the exact code I should be using (or if this is even possible).

Here's what I tried under advanced:

{
"fields": {
"reporter": {
"emailAddress": "{{customfield_116130}}"
}
}
}

 

How far off base am I?  🙂

 

Here's my automation, I have a precondition that first adds the customfield for the username and email address as a customer to Jira Service Desk (this part works!). 

Then it checks if  the reporter is the "system defined user" from the other app I use for user forms.  If it is, then change the user to the customfield for emailaddress.

I've tried various ways of inserting the reporter (email address, name, key) and none have worked.  It currently is successful on editing the issue field and changing the reporter, but the reporter now shows as "Anonymous" in the issue..

 

Screen Shot 2019-02-13 at 4.02.59 PM.png

 

 

6 answers

I'm having the same issue with updating the reporter based on an email address... does anyone have any clue with this?

Hello,

I've just recently looked for such a solution to actually take the email address from a summary or description (field substring smart value operation) and use it to update the reporter field on our tickets. 

How I'm doing it is by a Webhook request to the Jira API to fetch the user based on the user/search endpoint and from there using the response to populate the reporter field id. 

 

Send web request

Domain: Your company domain

Email: The email you want the accountId for

Token: The Authorization token required for the API call.

2022-05-23 13_25_41-Window.png

 

Edit Issue

2022-05-23 13_27_58-Window.png

 

These automations are the basic requirements for the function to work but I would suggest using some error handling for "webResponse.status = 200" and maybe some variable creation as well error handling for if there were more than one webResponse. 

Hope this might help someone.

I have contacted support and the answer is no - this not possible yet.

We can vote here to get this feature: https://codebarrel.atlassian.net/browse/AUT-1447

 

My workaround is to use a small microservice and the JIRA REST API to get the job done.

a) Query the reporter and remember the "id"

https://xxxx.atlassian.net/rest/api/3/user/search?query=mail@example.com

b) Set the reporter using the "id" though the API: 

https://xxxx.atlassian.net/rest/api/3/issue/DESK-3 

PUT Payload:

{
  "fields": {
    "reporter": {"id":"the:id-goes-here"}
  }
}

 

Hi @Anthony Polakos ,

Did you manage to get this to work without anybody having to manually select themselves via a userpicker form?

You can set the customer you just added as a new customer to reporter with this:

{
"fields": {
"reporter": {"id": "{{customer}}" }
}
}

I'm still struggling with customers that have send in a form before. They already exist in our project and therefore they don't trigger the 'add new customer'-step anymore, which means the 'customer'-fields aren't populated.

0 votes

Hi Anthony,

I don't believe the Jira API allows us to set the reporter via the email address only via username.   You would require the users to specify their username instead.

 

Cheers,
Brydie [Automation for Jira]

Thanks Brydie!  I’ll give that a try.

Unfortunately, that didn't seem to work, but I appreciate the help!

 

Which of the reporter fields do I need to send through? 

name (which looks like a unique identifer / random string, I'm really not sure I would procure since the user is being created on the fly)

or

displayName (This I can get from the customfield)

  • When I try to use displayName, the automation succeeds, but the reporter ends up anonymous.
  • When I try to use name, the customer is not found (but I'm just sending through the customer's name, not the identifier it seems to need)

Big question is how would I go about getting that unique identifer for the user to send thru when the user is being created during the process?

---

Typical API response for an issue with a reporter (that does have a customer attached to it):

Screen Shot 2019-02-14 at 8.57.58 AM.png

Hi,

I've managed to get this working using the following:

{
"fields": {
"reporter": {
"name": "{{issue.User Picker CF.name}}"
}
}
}

Where I have a custom user picker field where the user needs to select themselves.  That way I can access the unique identifier in that field.  Not sure if having the extra field is a feasible option for you.

Cheers,
Brydie

Is the issue that you need a way to find the JIRA username for a given Display Name or email address, in order to be able to set it?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

168 views 1 6
Read article

Atlassian Community Events