Hi, everyone!
I have code in a listener and I want to add a condition so that this listener will only fire if the myCF field has been changed.
And make it work for the Сurrent task and not just for: def issueKey = "RDY-12917" :
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
def customFieldPOactive = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_18429")
def issueManager = ComponentAccessor.getIssueManager()
def issueObject = issueManager.getIssueObject("${issueKey}")
def cfName = "Software(active)"
def cfPOactiv = issueObject.getCustomFieldValue("${cfName}").findAll().join("")
def regStringPOactive = (cfPOactiv =~ /RFA-\d\w+/).findAll().join("") // key for object "Software(active)": RFA-195553
def attrObjLineOfProduct = Assets.getByKey("${regStringPOactive}").getAttributeValues('Line of Product')
def regStringLineOfProduct = (attrObjLineOfProduct =~ /\d\w+/).findAll().join("")
def keyAttrLineOfProduct = 'RFA-'+ regStringLineOfProduct
def attrNameLineOfProduct = Assets.getByKey("${keyAttrLineOfProduct}")
def AttrValueLineOfProduct = (attrNameLineOfProduct =~ /\s*\(RFA-\d+\)/).findAll().join("") // value in attribute 'Line of Product' (in object - "Software(active)")
//<---------------------------------- Add value name in CF "Line of Product" --------------------------------------------------------------------------->
issueObject.update {
setCustomFieldValue('Line of Product') {
set(AttrValueLineOfProduct)
}
}
//<---------------------------------- Add value name in CF "Vendor(active)" ----------------------------------------------------------------------------->
def attrObjVendor = Assets.getByKey("${regStringPOactive}").getAttributeValues('Developer')
def regStringVendor = (attrObjVendor =~ /\d\w+/).findAll().join("")
def keyAttrVendor = 'RFA-'+ regStringVendor
def attrNameVendor = Assets.getByKey("${keyAttrVendor}")
def AttrValueVendor = (attrNameVendor =~ /\s*\(RFA-\d+\)/).findAll().join("") // // value in attribute 'Vendor(active)' (in object - "Software(active)")
issueObject.update {
setCustomFieldValue('Vendor(active)') {
set(AttrValueVendor)
}
}
Any help is important!
Thank you
Hi @Alex
you can use the following:
@Miklos Tix
Hello! Thank you very much for your work! It worked great! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.