Groovy script help

Sanu Soman
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 22, 2013

Hi All,

Please help me to write a groovy script, which has to auto select a custom field value (as part of create issue workflow transistion) based on combination of other two select list field values while creating a new issue.

Thanks.

1 answer

0 votes
Henning Tietgens
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 22, 2013

What did you have so far? You can use cfValues['cfName'].getValue() to get the value of a select list customfield. Than should update the issue with issue.setCustomFieldValue(...) depending on your logic.

If the target cf is a select list to you first have to get the option object of the option you want to set. An answers search should get you multiple answers how to get the option object.

Henning

Sanu Soman
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 22, 2013

Many thanks for the reply.

I'm very much new to groovy, so don't have any thing on my hand.. if possible could you please share some examples.. pls

For me, all three fields are single select custom field, lets say CF1, CF2, CF3 and CF1 having values 1, 2,3,4,5, and CF2 have values a,b,c, also CF3 having values jira, confluence, bamboo, fisheye

Here, everytime CF3 values obtained by create issue workflow transistion , means if users selected CF1 as 1 and CF2 as b then auto populate the CF3 value as jira after create issue transistion occured.

Many thanks in advance.

Henning Tietgens
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 22, 2013

I'm sorry but if you want someone to write you the post function you should pay someone to do this.

If you want to do it by yourself there are a lot of examples in the script runner wiki and provided by the plugin itself. You should try to learn how to do it, you will have to support it after it's implemented. And here on answers you will find pretty much anything you need to write the post function you want. If you have problems with your post function here are a lot people which will try to help you.

Suggest an answer

Log in or Sign up to answer