Forums

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

Who can help me with a Groovy Script condition?

Micha
Contributor
October 9, 2018

Hi all!


I never wrote any groovy scripts and we would like to do this, with a post-function in Insight:

Set a Jira custom field with the attribute value from a selected object

 

For this the documentation is too vague of Riada, it onyl tells the steps, but not how.

 

The only thing I don't know how to do is how to write to correct condition, which there is no example of in the documentation as well.

 

Who can help me with this?

 

 

1 answer

0 votes
Zihni Saglam
Contributor
October 12, 2018

Hi Micha,

What action would you like to perform? Can you provide us with more details?

Also, you can use the groovy script tester to test the outcome of your scripts. 

https://documentation.riada.se/insight/latest/insight-advanced-usage-guide/insight-for-developers/groovy-scripting

Here is some general info on how to get started with groovy. 

http://www.groovy-lang.org/documentation.html#gettingstarted

Tina
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!
October 16, 2018

Hi Zihni, 

Micha and I would like to add a post-function in Insight.

At the moment we have issues in Jira Service Desk, which are made after creating an Insight Object. The name of the Insight Object is the name of the issue, but there is also a custom field with more object information from Insight.

Within this Insight Object, there is an attribute which carries the value of a Referred Object. We want to view the value of this Referred Object in another custom field, but with the Insight custom field referred object, this has to be manually filled in.

Wat we want is to use a post-function to fill the value of the referred object in the custom field in the issue, using Groovy Script. 

This is the only thing we need to do and I guess we are not the only ones doing this. But because of the urgency and the lack of knowledge of Groovy script, we really hope someone can give the correct example condition for the post-function.

Thanks in advance!

Yinon Negev
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.
October 16, 2018

 Hi Tina.

You do not have to use Groovy Script to achieve this. You can either use the Insight Postfunction: Set a Jira custom field with the attribute value from a selected object  , where your Source CF is the one currently containing the Reference to another Object, the Source Attribute is the Object Type Attribute (where the reference is) and the Target CF will be another Insight Customfield.

Please note that if you use this Postfunction in the Create transition - you should set it AFTER the Issue Create function, and populating the first customfield.

Another option, is to use the Default Insight Object Customfield for the Second CF, with a Filter Issue and Filter Assign Scopes which will populate this CF automatically by making the Assign Filter Strict;

Filter Scope: objectType = <please indicate the expected Object Type here>

You can define the both the Filter Issue Scope and the Filter Assign Scope as:

object HAVING inR(anyAttribute = ${customfield_nnnnn})

Where nnnnn should be replaced by the first CF id (alternatively you can use ${CustomfieldName} stating the customfield name...

This can be refined if needed, depending on your use case...

If you check the option to "Make Filter Assign Strict" - the CF will be populated Automatically, and will change, should you decide to change the Object in the first CF...

Cheers,

//Yinon

Like Julian from AF likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events