Groovy script help

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 Community Champion Oct 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

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 Community Champion Oct 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
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,817 views 18 22
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you