how to get Value from a referenced insight object attribute

Nina Gogeshvili March 16, 2023

Hello,

 

in my very first groovy I am trying to get all the information from a referenced insight object.

-> Datacenter/ workflow post function. 

 

let's say one of my fields i want to transfer is name of service -  issueNameCF - the field on the issue and insightNameCF - from the Insight object.

I have an insight field on the issue - issueServiceCF.

 

/* Custom field for the Name and Service */

CustomField serviceCF = customFieldManager.getCustomFieldObject(11054);

def issueNameCF = customFieldManager.getCustomFieldObjectByName("Name");
CustomField nameCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10000);
def insightNameCF = issue.getCustomFieldValue(nameCF);
issue.setCustomFieldValue(issueNameCF, insightNameCF)

return true;

 

is this already enough to make a connection between issue.customField and issue.customfield.insightfield ? so let's say, get the value from the insight field, something like this.
issueNameCF = issueServiceCF.insightNameCF ?

Thank you!

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2023

Hi @Nina Gogeshvili

If you would like a more straightforward approach to gathering the details from Insignt / Assets, I suggest looking into ScriptRunner's HAPI feature.

You can refer to this ScriptRunner Documentation for examples of how to work with the Assets and gather the details.

To be able to use these features, please ensure that you upgrade your ScriptRunner plugin to at least 7.11.0. I recommend upgrading to the latest release, i.e. 8.3.0.

I hope this helps to answer your question. :-)

Thank you and Kind regards,

Ram

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events