Forums

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

LATE state in the Task flow?

sabina volpicelli
May 9, 2023

Is it a good idea to have a LATE state in the Task workflow or are there better way to monitor late tasks?

2 answers

2 accepted

2 votes
Answer accepted
Mark Markov
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.
June 18, 2018

Hello @Marcin Beczynski

Are you creating custom script listener?

It can be done like this:


import com.atlassian.jira.component.ComponentAccessor

def change_cf1 = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "field1"}
def change_cf2 = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "field2"}
def customFieldManger = ComponentAccessor.getCustomFieldManager()
def cf1 = customFieldManger.getCustomFieldObjectByName("field1")
def cf2 = customFieldManger.getCustomFieldObjectByName("field2")

if ((change_cf1 || change_cf2) && (event.issue.getCustomFieldValue(cf1).equals(event.issue.getCustomFieldValue(cf2))) ) {
//put your code here
}   

Must listen Issue Updated event and may be need some null checks on getCustomFIeldValue :)

Hope it helps!

1 vote
Answer accepted
Tiffany Wortham
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.
June 18, 2018

Ivan,

Try this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;

def customFieldManager = ComponentAccessor.customFieldManager
def issueManager = ComponentAccessor.issueManager

def cf1 = customFieldManager.getCustomFieldObject('customfield_10200')
def cf2 = customFieldManager.getCustomFieldObject('customfield_10201')

def cfValue1 = issue.getCustomFieldValue(cf1)
def cfValue2 = issue.getCustomFieldValue(cf2)

if (cfValue1 == cfValue2){
//code you want to run
}

Of course, you'll want to replace the custom field ID's with the ID's of your custom fields, which you can find by going to edit your custom field, and getting the ID from the URL as in the following screenshot:

 customfieldid.png

Kind regards,

Tiffany

Suggest an answer

Log in or Sign up to answer