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
I would like the ability to read a given Custom field Context (context created for designated projects) and use the description on the context to display in place of the standard description on the field.
I have used the behaviours to display a basic string, but I can not find anything in the Jira developers guide of how to get to this information.
I was hoping for something along the lines of:
getFieldByName("Select List 1").setDescription(CFContext.description)
Thanks,
Jodi
Hi @Jodi Gornick , you can use this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.fields.config.FieldConfig
import com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManager
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
FieldConfigSchemeManager fieldConfigSchemeManager = ComponentAccessor.getFieldConfigSchemeManager()
CustomField cfSelecList1 = customFieldManager.getCustomFieldObject(10802L) // Change this with the ID of your SelectList CF (XXXXXL)
FieldConfig fieldConfig = cfSelecList1.getRelevantConfig(issueContext)
String description = fieldConfigSchemeManager.getConfigSchemeForFieldConfig(fieldConfig).getDescription()
getFieldById("customfield_10802").setDescription(description) // Change this with the ID of your SelectList CF ("customfield_XXXXX")
Check the comment on the code to modify it.
Regards!
I had to make a couple changes to make it more versatile, but this put me on the right path so thank you!
Created as a Behaviour with the following code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.fields.config.FieldConfig
import com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManager
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
FieldConfigSchemeManager fieldConfigSchemeManager = ComponentAccessor.getFieldConfigSchemeManager()
CustomField cfSelecList1 = customFieldManager.getCustomFieldObject(getFieldChanged())
def formField = getFieldById(getFieldChanged())
FieldConfig fieldConfig = cfSelecList1.getRelevantConfig(issueContext)
String description = fieldConfigSchemeManager.getConfigSchemeForFieldConfig(fieldConfig).getDescription()
formField.setDescription(description)
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.