Set a field value based on date/time/day condition

We're building a Jira Service Desk (server version) to manage Change Requests.  Each Wednesday is our current Change Review Meeting.

We need a way to force an issue's Change Type field to "Emergency," and not "Normal" if the submitter chooses an implementation date & time that's prior to noon on the following Wednesday

What is the best way to check for the condition, and update the Type field when the condition's met?  Can this be done with a base Jira Service Desk install, or is an add-on required?  If an add-on, which one(s), and how would the condition be checked (JQL? Scripting of some sort? other?).

Is Script Runner a, or THE, recommended Swiss Army Knife of tools for Jira admin?  Or is the condition check and field set function I'm after more likely a combination of tools?

Thank you,


1 answer

1 accepted

0 votes
Accepted answer


You can do it with Service Desk automation if your Service desk version is 3.3 or higher. 

1. Create automation rule.

2. Add "Issue created" to When condition .

3. Add "Implementation Date" < startOfWeek(252h)  to If condition. Add action Edit Issue and edit there "Change Type" field to "Emergency"

5. Add "Implementation Date" >= startOfWeek(252h) to else if condition.  Add action Edit Issue and edit there "Change Type" field to "Normal"

If your version of Service Desk is lower than 3.3 then you can use Automation Lite plugin. The setups basically the same.

Thank you.

I only have Automation Lite (can't pay for full add-on, yet).  Are the conditions you list JQL conditions, or Compare conditions (or another)?  Since I only have lite, Compare isn't available, so I chose JQL condition.  I can't find an "else if," all that's there is "and," but maybe that's due to the fact I'm only using the lite add-on?

I also get errors on the 2 fields I'm trying to apply the condition to (Change start date, and Due Date).

Start date error is in the screen shot attached.  When I use the Due Date field, which does exist, it throws the error "Field 'Due Date' does not exist or you do not have permission to view it."  I'm setting this up as an Admin, and the Due Date field is viewable by all.

Also, what's the significance of the 252h in startOfWeek(252h)?  252 hours = 10.5 days?  Or, does startOfWeek(252h) return "Wednesday 12:00pm?"  Just trying to follow the logic/calc.  Is the check "is the start date less than 10.5 days away," or "is start date earlier than Wednesday at 12pm?" (presumably the upcoming Wednesday).

Thanks, again, for your help.  I'll keep working at it.


1. These are JQL conditions (in your picture it would be If issue matches JQL)

2. That is right. There is no else if.  You need to create two rules. One rule for each JQL condition

3.1. What type of a custom field is "Change start date"? Also go to system-issues-custom fields, find "Change start date", click Edit and make sure that search template is chosen

3.2. in JQL you need to type "duedate" not "Due Date"

4. 252h = 24h*10d + 12h. StartOfWeek() gives you first day of the current week (in my case it is Sunday. Check what it is in your case). then you add 10 days and 12 hours and that would be next Wednesday 12:00pm

If you have other questions, do not hesitate to ask.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Friday in Jira Service Desk

Are you a Jira Service Desk agent? We want to talk to you!

Are you a whiz at handling tickets and looking at how you can further optimize your workflow with automation? Do you tackle detailed customer support questions while simultaneously getting flooded wi...

138 views 0 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you