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
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi Team,
I'm trying to put together a behaviour in scriptrunner where during transition (RFP to Implementing) user required to change a custom field IF this field has certain value (Unknown, Backlog, Test A), lam pretty new to coding, any idea is appreciated.
Field Name: Planned Version
Field type: Version Picker (multiple version)
Condition: ask to update field if the field has the value (Unknown, Backlog, Test A)
import com.atlassian.jira.component.ComponentAccessor
def sourceStatusId = jiraHelper.getStatusByName("RFP").iddef targetStatusId = jiraHelper.getStatusByName("IImplementing").id
def PlannedVersionField = = getFieldById("customfield_10000")
if (issue.status.id = "targetStatusId") {
if (getFieldById.value == "Unknown" || "Backlog" || "Test A") {
ASK user to update the field "Planned Version"
}
}
Here is how I would do it
def plannedVersionField = = getFieldById("customfield_10000")
plannedVersionField.clearError()
def goingToImplementing = destinationStepName == 'Implementing'
def comingFromRFM = underlyingIssue?.status.name == 'RFP
def valuesThatRequireChange = ['Unknown', 'Backlog', 'Test A']
if(comingFromRFM && goingToImplementing){
if(plannedVersionField.value in valuesThatRequireChange){
plannedVersionField.setError("Please update. ${valuesThatRequireChange.join(',')} are not allowed when movig from RFP to Implementing")
}
}
Hi,
to do this, you could add a Simple scripted validator on the transition with this Condition:
!["Unknown", "Backlog", "Test A"].contains(cfValues['Your Custom Field'])
and setting the Error Message with a message like the following:
Please, update the field: Planned Version
And selecting the Field: Planned Version.
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.