Hello,
I am using the automation module to change the Rank of some type of issues:
Looks like I need to use the "Send web request"
Can you help me plz,
Thanks,
Abir
Hi @Abir Brahem
What problem are you trying to solve by doing this? That is, why do this? Knowing that may help the community suggest additional ideas.
Until we know that...
It is possible to call a REST API function to set the rank of one (or more) issues relative to another issue. And so the rule would need the key for the issue above / below which to re-rank the target issue.
This how-to article describes how to call a REST API function from a rule using the Send Web Request action: https://community.atlassian.com/t5/Jira-Software-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828
I recommend contacting your Jira Site Admin before writing this rule as they may provide some additional support.
Kind regards,
Bill
Hello Bill,
Thank you for the link, now I am able to request the JIRA Cloud API.
I would like to change the rank of some type issues to the top.
I found this end point in the documentation:
The Jira Software Cloud REST API (atlassian.com)
I tested with PostMan and I it is possible to change the rank:
rest/agile/1.0/issue/rank
request body:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you discussed this scenario with your Jira admin yet? I recommend doing that before you proceed further, as you have not explained the problem you are trying to solve and the conversation with your admin may help.
For example, you do not describe why or when this change of rank is needed, and those impact the rule trigger and issue context for making changes.
Regarding the rule specifics, as you have already successfully called the REST API function with PostMan and you have the how-to article for calling the function from a rule, you can use that request body as a template in your Send Web Request action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I am a JIRA admin, unfortunately there no expert more then me in the company.
The trigger is when issue created and if issueType is Bug (I can't add screenshot, I don't now why..)
I can't use the send Web Request because I need the highest issue key as I descibe in my last message.
Is that clear?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let's assume this is for one project and you only care about issues in the backlog. To find the issue which is currently the highest-ranked one, JQL may be used:
project = yourProjectName AND status = Backlog ORDER BY Rank ASC
The first one in the list is the highest-ranked issue.
Thus a rule could use the Lookup Issues action with that JQL to gather the first 100 issues found, and the first in the list would be the key needed for the request:
{{lookupIssues.first.key}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy and @Abir Brahem I'm trying to achieve something similar. Reason being is that when issues are created by any one of the 20 members in the team they can be lost in the backlog.
So I want a rule that that runs once a week to find any issues marked as Security and or Compliance (custom field) and move them to the top of the backlog so that when we do sprint planning those items are always first.
Does that help with the Why?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill, Thank so much, I succesfully update the Rank finally !
@Brendan Betheldo you request is a little bit more complicated: you can Inspired by my rule (see below). First of all, to change the trigger to Scheduled and you need to change the web request body to:
{
"issues": {{lookupIssues.key.asJsonStringArray}} ,
"rankBeforeIssue": "{{lookupIssues.first.key}}"
}
You need juste to check if the the smart value returns an array of the liste of all the issues to Rank, I am not sure about the right syntax, @Bill Sheboy what do you think?
This is my rule:
Have a nice day,
Abir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For the field rankBeforeIssue, only one issue key is expected. And so using the first one from the lookup helps ensure that.
Also...the criteria for your linked issues condition and the lookup issues are different. Thus it is possible the lookup issues could return zero or more issues. (It could return zero due to the possibility of timing issues for the Transition Issue step immediately before the lookup, and so not even the trigger issue is found.)
I recommend two changes:
1) Add criteria to the lookup issues action to exclude the trigger issue with:
AND key != {{triggerIssue.key}}
2) Adding a smart value condition after the lookup to ensure at least 1 issue is found:
These changes will prevent any attempt so re-rank an issue ahead of itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Abir Brahem and @Bill Sheboy
Is the authorization in my header just email and API key?
Eg firstname.lastname@email.com.au:xxxxxxxxxxxxAPI_KEYxxxxxxxxxxxxxxx
I've added that in authorization header but I get a 401 and have used the same API key before without issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Brendan Betheldo
The autonfication Value filed is:
Basic HzxuhHbhzhdjasYTgdjGfrGHzxuhHbhzhdjasYTgdjGfrG
The key after Basic is YOUEMAIL:API_TOKEN coded id base 64
You can use this online tool to encoded them in base 64
Best Regards,
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.
What was the final version of this PUT body? I have tried both what is included in the above post and screenshot, and I get errors with both.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Quinn Wood -- Welcome to the Atlassian Community!
Context is important for automation rule questions.
Please post an image of your complete rule, an image of the Send Web Request action, and an image of the audit log details showing your rule execution.
And, where are you observing errors: when creating the rule, when running the rule, something else?
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was able to get this working. Thank you.
I didn't have a valid lookup, so the web request was missing the information.
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.