Hi All,
I'm aware of two options of adding default values to a custom field, by editing the field or using behaviours. Unfortunately the inputted text isn't appearing as expected.
Custom Field
I updated the custom field directly adding a default value, but the text isn't appearing. I re-indexed the project and restarted browsers, but no joy.
Behaviours
I recycled and tweaked behaviours which already work for other custom fields, but no joy. (script versions below) However, when using script in conjunction with an issue type for a different custom field worked. Although assigning an issue type and using my custom field didn't work.
Version 1:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
def desc = getFieldById("customfield_xxxxx")
def defaultValue = """h4. Header One
- Add text here.
h4. Header two
- Add text here.""".replaceAll(/ /, '')
Version 2:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
def desc = getFieldById("My Custom Field")
def defaultValue = """h4. Header One
- Add text here.
h4. Header two
- Add text here.""".replaceAll(/ /, '')
Making both updates haven't made the new text appear.
I would appreciate help on how to troubleshoot and ultimately fix this issue.
Thanks.
Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!
Help us plant more trees