You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.