Forums

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

JIRA - ScriptRunner - Insight - Groovy - get Insight custom field value

Markus May 29, 2018

Hi,

 

I try to pre-fill an Insight custom field with ScripRunner Behaviours.

Basically I am struggeling getting the options out of the custom field I want to prefill. Here's the code I use so far (with some logging)

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

def field = getFieldByName("SP Anzahl RAM")
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObject(field.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)

Debugging this I get the following content of config: "com.atlassian.jira.issue.fields.config.FieldConfigImpl@d59871da" 

and options seems to be empty "[]"

 

what am I missing?

 

Thank you

Markus

 

2 answers

1 accepted

0 votes
Answer accepted
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2018

Hi Markus.

Currently we do not support behaviours for JIRA. I'm actually the developer assigned to this feature. 

You can follow the development of this issue here:

https://productsupport.adaptavist.com/browse/SRJIRA-2563

Cheers!

DYelamos

Markus May 30, 2018

Hi Daniel,

 

thanks for the update. Sad to hear, that this isn't working, but good to hear, that it's already adressed. I will watch the issue.

 

Cheers

Markus

Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2018

Hi Markus.

No problem. Could you please accept my answer so that other users know that this question has been solved? 

Cheers

DYelamos

0 votes
Mario Gerlach
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 9, 2024 edited

Assets / Insights have the key of the Insightobject therefore:

 

  1. Search the Key
  2. Set the Key as FormFieldValue

 

def asset = Assets.search(/objectType ="YOUROBJ" AND Name  = "YOURLABEL"/)

def key = asset.next()?.getObjectKey()

   getFieldByName("YOURFIELD").tap{

      setDescription(key)

      setFormValue(key)

    }

 

 

Suggest an answer

Log in or Sign up to answer