Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do i get all customFieldOption objects?

Tavares Forby April 29, 2020

I'm having an issue getting all customFieldOption objects.  How can i get them? I'd like to map the custom field option name with it's id.  Thoughts? 

1 answer

0 votes
Moses Thomas
Community Champion
April 29, 2020

@Tavares Forby 

I  hope i understand what  you  are asking.

If you have the Script runner plugin you can go this way .


Now to get the custom field object, press F12 then click on inspect in the Firefox developer view, drag the cursor to the field on create screen,  and then you will see "customfield_id" You can also get the by going to custom field on the JIRA admin panel and edit the field then you will see the id, so you will now have "customfield_id"


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField

CustomField cf86900 = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_86900")
String cf86900Value = issue.getCustomFieldValue(cf86900) 

 

Kind regards,

Mo

Tavares Forby April 30, 2020

import jira.component.ComponentAccessor
import jira.issue.CustomFieldManager
import jira.issue.fields.CustomField

 

doesn't exist.  I do not have access to CustomFieldManager.  I've tried various methods. 

Moses Thomas
Community Champion
April 30, 2020

Do you have the script  runner plugin for Jira, you need this plugin.

Tavares Forby April 30, 2020

yes i do need this plugin.  How do i get the plug in?

Tavares Forby April 30, 2020

this is for Python

Moses Thomas
Community Champion
April 30, 2020

You need to install it depends where exactly you want to place your script for eg. Postfuntion script on work flow transition  e.t.c you can download here 

Script runner plugin  

Kind regards,

Mo

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events