I have a post function script which creates a new issue(of different issue type), in the new issue I have to set the value of a multi select custom field to its default value (during the new issue creation).
Hey Praveen,
So in order to get the default configured value for a custom field the way to do will be something like
def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("CustomFieldName")
def givenIssueContext = new IssueContextImpl(issue.projectObject, issue.issueType)
def globalContext = IssueContext.GLOBAL
// depends on your cf configuration use the globalContext or the givenIssueContext
def fieldConfig = ComponentAccessor.fieldConfigSchemeManager.getRelevantConfig(IssueContext.GLOBAL, cf)
def defaultValue = cf.getCustomFieldType().getDefaultValue(fieldConfig)
Hope that helps, ping me if you have any more questions.
Regards, Thanos
Hello,
I think it is simpler to set a default value for the field in a standard Jira configuration. You can read here more about it
https://confluence.atlassian.com/adminjiraserver071/configuring-a-custom-field-802592532.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alexey, we have already set the default value as the required one. But the real problem is we are creating the new issue using GROOVY, that doesnt set the field value to the default one and it remains empty.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is your creation script?
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.