It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
hi all,
I received the following code snippet from a user in this forum, this works great but it fires even when the select list is not changed. is it possible to fire this only when the select list value changed and during the edit action of the issue ? Please let me know.
// Get a pointer to both my fields def demoSelect = getFieldByName("Demo Select List") def demoMultiTxt = getFieldByName("Demo Multi Line Text Field") // Get the Value of the Select List Field def selectedVal = demoSelect.getValue() if (selectedVal != null){ demoMultiTxt.setRequired(true) }
Hi @saravanan subramanian
You can get the original value of the issue's custom field using underlyingIssue. For example in your case should be :
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issue = underlyingIssue
def tgtField = customFieldManager.getCustomFieldObjects(issue).find {it.name == "Demo Select List"}
// Get a pointer to both my fields
def demoSelect = getFieldByName("Demo Select List")
def demoMultiTxt = getFieldByName("Demo Multi Line Text Field")
// Get the Value of the Select List Field
def selectedVal = demoSelect?.getValue()
def previousVal = tgtField?.getValue(issue)
if (selectedVal?.toString()?.equalsIgnoreCase(previousVal?.toString())) {
log.debug("Values are the same I will set the require to false")
demoMultiTxt?.setRequired(false)
} else {
log.debug("Values are different I will set the require to true")
demoMultiTxt?.setRequired(true)
}
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.
Read moreAtlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.