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.
Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.
Register nowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.