created an automation rule that the XYA projects with the status in backlog,to list all the priority values are not null, did checked if the priority value is duplicate then update the duplicated value into next value then do the same for rest of them and make that the prioriy is unique value. below are the steps i did followed
1. Trigger: Scheduled
Choose Scheduled.
Set JQL: project in (RPA_PROJECT_KEYS) AND component = "creditrisk and operations" AND status in (backlog statuses) AND "{{PRIORITY_FIELD_ID}}" is not EMPTY ORDER BY "{{PRIORITY_FIELD_ID}}" ASC.
Schedule: e.g., daily or weekly to process backlog.
2. Action: Lookup Issues
Add Lookup issues action.
JQL: Same as trigger JQL to fetch all matching issues with non-null priorities.
This stores issues in {{lookupIssues}} for branching.
3. Branch: For Each Issue (Process Sequentially)
Add Branch rule / related issues > Issues from lookup.
Inside branch: Process {{lookupIssues}} one-by-one to check/update duplicates.
4. Inside Branch: Check for Duplicates (Web Request)
Add Send web request.
Webhook URL: https://your-jira.atlassian.net/rest/api/3/search?jql=project in (RPA_PROJECT_KEYS) AND component = "creditrisk and operations" AND status in (backlog statuses) AND "{{PRIORITY_FIELD_ID}}" = "{{issue.customfield_{{PRIORITY_FIELD_ID}}}}" AND key != "{{issue.key}}".
HTTP method: GET.
Headers: Authorization (if needed), Accept: application/json.
This counts duplicates: If {{webResponse.body.total > 0}}, it's a duplicate.
5. Condition: Has Duplicates
Add Advanced compare condition.
First value: {{webResponse.body.total}}.
Condition: greater than.
Second value: 0.
If true, proceed to update.
6. Action: Update to Unique Value
Add Edit issue.
Use Additional fields with JSON for rank/priority update:
text
{
"fields": {
"{{PRIORITY_FIELD_ID}}": "{{triggerIssue.customfield_{{PRIORITY_FIELD_ID}}.value + 1}}"
}
}
here the loop is not working, it still accepting the duplication, can someone help me to fix this, appriciated your help in advance