I am trying to build a Jira Automation rule that updates the reporter of an issue based on a custom field.
/rest/api/3/user/search?query=<text>
) to retrieve the correct user’s accountId./rest/api/3/issue/{issueKey}
) to set the reporter of the triggered issue.The problem:
{{webhookResponse.body}}
is empty).accountId
dynamically.My questions:
Hi @MOOC Tac Thanh -- Welcome to the Atlassian Community!
In the rule images you show for the Send Web Request action, you have not checked the option to:
Delay execution of subsequent rule actions until we've received a response for this web request
Thus the rule continues to process before the response. Please enable that option and re-test your rule.
Kind regards,
Bill
Welcome to the community.
Set the value in the API call as follows: {{issue.<field name}}
So the call would be: /rest/api/3/user/search?query={{issue.<field name>}}
Use {{webResponse.body.accountId}} to get the account ID
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I already use it, but when loggging out the result I don't have value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
and here is how I config my request :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What type of field is customfield 11038, what is the usual input (value of this field, give an example) and can you show me the details of the log action
Also what do you see as a value when doing a log action on just the field {{issue.customfield_11038}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Marc - Devoteam ,
Customfield_11038 is a text field, I create this field to retreive user qTest who create an issue. So for example when I log action this field I have "Tac Thanh MOOC".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Marc - Devoteam and here is my full log action :
The lasted send web reqquest is where I use my PUT to update "Reporter"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So you created a variable called qTestReporter
So then use the API call: /rest/api/3/user/search?query={{qTestReporter}}
Other question what kind of Toke do you use a full API or a scoped API token?
If you use a scoped API token, then you need to use the API call like:
https://api.atlassian.com/ex/jira/<cloudId>/rest/api/3/user/search?query={{qTestReporter}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As @Bill Sheboy mentioned, check the option "Delay execution of subsequent rule actions until we've received a response for this web request"
Save the rule and run again
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Marc - Devoteam ,
Regarding your question, I am using a full API token.
Hi @Bill Sheboy ,
Based on your suggestion, I tried using the option “Delay execution of subsequent rule actions until we've received a response for this web request” for both requests, and I also called the API using like @Marc - Devoteam suggestion :
"https://api.atlassian.com/ex/jira/ <cloudId>/rest/api/3/user/search?query={{qTestReporter}}"
I still have the same result
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Look like after my GET I receive an empty response
and the PUT request can't send with an empty value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the result when you just make the get in your browser or a tool like postman
So make a call in the browser window via: https://<your-instance-name>.atlassian.net/rest/api/3/user/search?query=Tac Than MOOC
or
https://<your-instance-name>.atlassian.net/rest/api/3/user/search?query="Tac Than MOOC"
Above if the token is not a service account or scoped token.
Or is you use a service account or scoped token:
https://api.atlassian.com/ex/jira/<cloudid>/rest/api/3/user/search?query=Tac Than MOOC
or https://api.atlassian.com/ex/jira/<cloudid>/rest/api/3/user/search?query="Tac Than MOOC"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Marc - Devoteam
For the call in browser with
https://<your-instance-name>.atlassian.net/rest/api/3/user/search?query=Tac Thanh MOOC
or
https://<your-instance-name>.atlassian.net/rest/api/3/user/search?query="Tac Thanh MOOC"
I have some information :
but with
https://api.atlassian.com/ex/jira/<cloudid>/rest/api/3/user/search?query=Tac Than MOOC
or https://api.atlassian.com/ex/jira/<cloudid>/rest/api/3/user/search?query="Tac Than MOOC"
I have nothing :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So if you now in you automation rule use
https://<your-instance-name>.atlassian.net/rest/api/3/user/search?query={{qTestReporter}}
or
https://<your-instance-name>.atlassian.net/rest/api/3/user/search?query="{{qTestReporter}}"
Then a log action
{{webResponse.boy.accountId}} should provide the account ID
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I have an empty response
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try using the suggested URL for the endpoint from @Marc - Devoteam
And, writing the entire {{webResponse.body}} to the log to confirm the result when testing. This should produce a list of zero-to-many values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.