The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.
Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.