Could you please help on this script. I am very new to grrovy script
How Can we set the capitalization field automatically based on the value of BugType field, meaning if the BugType is Production set Capitalization to No and if the BugType is Pre-Production set Capitalization to Yes.
My thought on doing this would be to create a script runner Script Custom Field. This would make the field read-only but can be searchable, and the value would be dependent on a script. That way you can have the script check the value of the BugType type field and present the "Yes" or "No" values automatically and change whenever the BugType field changes.
Sure. Here's a sample. The return sets the value of the scripted field. It looks up the custom field based on name. There is another function which may be safer which looks up the function based on Id, called getCustomFieldObject(). I used the function which looks up by name to make the code easier to follow but could return a collection of customfield objects based on the API.
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def myTestField = customFieldManager.getCustomFieldObjectsByName('BugType');
//def myTestField = customFieldManager.getCustomFieldObject(10024);
def testvalue = issue.getCustomFieldValue(myTestField);
if (testvalue.toLowerCase() == 'production') return "No";
else return "Yes";
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Atlas 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 group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs