Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

If 'Day of week' then do action... JQL?

Julia Downs
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 22, 2021

Is it possible to build this into my automation?

I want it to email specific people on specific days to alert them that something has arrived into their designated column (status).

Person A on days: Monday, Wednesday and Friday, and Person B on Tuesday and Thursday. 

What would be the JQL for it? 

Thanks

7 answers

1 vote
JohnsonHoward
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 4, 2017

Hi,

Try adding the following code to a scripted field named "Risk Rate":

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue


Issue mainIssue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def impact = customFieldManager.getCustomFieldObjectByName("Impact")
def probability = customFieldManager.getCustomFieldObjectByName("Probability")
def impactVal = mainIssue.getCustomFieldValue(impact).toString().toInteger()
def probabilityVal = mainIssue.getCustomFieldValue(probability).toString().toInteger()
def overallRating = (impactVal * probabilityVal)
def result = ""

switch (overallRating) {
case { overallRating < 5}:
result = 'Low'
break
case {overallRating >= 5 && overallRating <= 9}:
result = 'Medium'
break
case {overallRating > 9}:
result = 'High'
break
default:
result = 'N/A'
break
}

return result;

You will have to change the names to match your field names and the case values to your preference. I have made the assumption here that the custom fields are text fields, so I casted them to string then to int. You will not need to do this is the field values are already numbers.

Also, if you would like both a risk rate numerical field and a text field then you will need to add a second scripted field and just return the 'overallRating' value instead of using the switch statement.

Take a look at this for more info on scripted fields: https://scriptrunner.adaptavist.com/latest/jira/scripted-fields.html

 

0 votes
JohnsonHoward
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 18, 2017

Hi, 

Did this solve your problem?

Regards,

Johnson Howard

0 votes
l
Contributor
January 15, 2017

Any update???

 

0 votes
l
Contributor
January 11, 2017

customfield_17796 and customfield_23399 are select list and customfield_28038 is number field and customfield_26609 is a text field

0 votes
Thanos Batagiannis [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 11, 2017

and what about customfield_28038, customfield_26609 ?

0 votes
l
Contributor
January 11, 2017

yes, these are select lists

0 votes
Thanos Batagiannis [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 11, 2017

Hi,

What type are the custom fields customfield_28038, customfield_26609 ? I suppose the customfield_17796 and customfield_23399 are select lists (single choice) .

 

Suggest an answer

Log in or Sign up to answer