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.
This is the below code i have used and had no working , Aggregate status is the field name , Design is the values want to set on transition Todo ==> inprogress
Code 1 tried :
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'MyCustomFieldType'}
issue.setCustomFieldValue(cf, 'Design')
compiled without error and its not working
Code 2 tried :
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.customfields.manager.OptionsManager;
import com.atlassian.jira.issue.customfields.option.Option;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.MutableIssue;
MutableIssue currentissue = currentissue // Any one please explain what is mutable issue ?
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Aggregate status'}
def fieldConfig = cf.getRelevantConfig(issue)
Option value = ComponentAccessor.optionsManager.getOptions(fieldConfig)?.find { it.value == 'Design' }
issue.setCustomFieldValue(cf, value)
its not working and I need assistance from community .
Thanks and i appreciate your information .
@Maha vishnu v Try this. I have tested it and it works. Accept the answer if you are happy so it can help others too.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
// the name of the custom field (single select list type)
final String customFieldName = "AIQ Detectability"
// the value of the new option to set
final String newValue = "Yes"
def customField = ComponentAccessor.customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName)
//assert customField : "Could not find custom field with name $customFieldName"
def availableOptions = ComponentAccessor.optionsManager.getOptions(customField.getRelevantConfig(issue))
def optionToSet = availableOptions.find { it.value == newValue }
customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), optionToSet), new DefaultIssueChangeHolder())
Its working and i'm happy with your answers .
Can you please help me on this additional same functionality below with code alternatives for Date field and multiple select list fields ?
On transition i would like to defining Due date and Multiple select list field values in place of ( select list field in above code )
your answers could be more helpful .
And Please correct my code in description , Where it was wrong and i would like to get good approaches to learn script runner with groovy scripts ? Since I'm a beginner , this could be more helpful to get started .
Much Thanks !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have any information on my above appended request ?
If yes , It helps me a lot !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi can we do use the same JIRA 8.2?
I am unable to do.
When user transit in Progress it should set customfield_xx (single select) value to 'ABC'.
Before In progress there is no value for the above custom field.
Any help will be appreciated.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What plugins do you have? Let me know so I can help you with the changes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this -
issue.setFieldValue("Aggregate status",'Design')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you try the above suggestion?
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.
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.