Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,460,910
Community Members
 
Community Events
176
Community Groups

Starting an automation but only when a specific field has a specific value

I have 2 projects.  When a ticket is raised in project1, a ticket is auto created in project2 and added as a linked item. the project 2 ticket is only created and linked if a specific field has a specific value.

The issue us that project 1 is used for other tickets also and we are nearing our monthly quota for executions.

Ideally, I only want the automation rule to run is a specific field has a specific value. (for some reason I cannot add a screenshot).

The rule starts off with 'When: Issue created' so it runs every time

Any ideas would be appreciated.

 

4 answers

1 accepted

0 votes
Answer accepted

Hi @Lance Shaw 

From what you described, I suspect you are running this as a global/multi-project scope, rather than a single project scope rule.  Is that correct?

If so, you can do what you need with a project scope rule, eliminating the need to use up your rule execution limit for global rules.

For example:

  • trigger: issue created
  • action: re-fetch issue (This can help to slow the rule and reload the data.  Sometimes the issue created trigger runs too fast.)
  • action: create a new issue, selecting the other project
    • set the fields as you need, perhaps copying from the trigger issue
    • to link the uses, use the advanced edit with JSON, such as this
{ "update": {
"issuelinks": [
{
"add": {
"type": {
"name": "Relates"
},
"outwardIssue": {
"key": "{{issue.key}}"
}
}
}
]
}
}

 

Kind regards,
Bill

Thanks for that Bill. This works without using the execution limit. Struggling with the second part though.

The status of project1 updates and I need to update the status of a linked issue for project 2 to the same status.

I've started it with Issue Transitioned and then use a Branch Rule/related issues object and then a JQL statement of 'project = project2', but as this Rule is in project 1 it does not seem to see project 2. In the audit log, it shows 'No related issues could be found'

any pointers please

Regards Lance

A project-scope rule cannot transition (or make any edits) to issues in another project directly.

You would need to use a global/multi-project scope rule to do so...and that will be impacted by the limits of your Jira Cloud license level.  In general, I suspect such a rule would viable for a Premium license, as it can have a lot more global rule runs per month.  For other levels you could quickly run out of your limits.

One possible work-around is to have the project-scope rule make the transition by calling the REST API method: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-post

If you want to try that, here is a how-to article for calling the REST API from a rule: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

0 votes
Rilwan Ahmed Community Leader Dec 22, 2022

Hi @Lance Shaw ,

Welcome to the community !!

The automation rule will trigger for every ticket created irrespective of conditions, but it wont create a new ticket until the given condition is met.
We cannot make rule to run when only particular ticket is created.

Hi Rilwan

Is there not a conditional trigger or some JQL that would allow this?

Hi @Lance Shaw 

You can try creating new rule as below

Trigger == Issue created
New condition == Issue fields condition, select labels field and the value required.
New Action == Create issue

image.png 

Please note: The rule will for all tickets created, but linked issue will be created only when the condition given is met.

Hi Rilwan

Will that not still run every time an issue is created?

I'm looking at using a schedule trigger to run maybe every 2 hours and then proceed with creating a new ticket if the condition of the schedule is true.

So we can have up to 100 tickets a day created and at present, that will run the rule 100 times.  If we have a schedule for every 2 hours then this will only be 12 times.

Our monthly execution is set to 500 so just this one rule could exceed that value in a week as it's currently set

Rilwan Ahmed Community Leader Dec 22, 2022

Hi @Lance Shaw 

1. Will that not still run every time an issue is created? 
-- Yes, it will run. But it will not impact anything unless you have 100s ticket created in very short time like 1-5 minutes. 

2. You can. Use Scheduled trigger and JQL can be 
created >= -2h and labels = 'sample-space'.  Modify the JQL as required for you. 

image.png

Hi Lance,

Could you try using the trigger "field value changed"?image (76).png

Hi Tara

The issue is the field holds the value when the ticket is created.

Also the field in question is called label and a label is added at various parts of the tickets life so each time a label is added, then the rule will still run

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events