Make a linked issue field required based on custom field value by Script.

Hello,

I want to make a linked Issue Field required during a transition based on Custom field value.

Here I had a custom field single select "Opinion" have 'will do' 'will not do' 'future' 

During the Transition, if the Opinion is 'will do' then we need to provide required Links in Linked Issue field or else should throw an error, whereas if we select any other value (will not do or future) Transition should go forward without asking any link to fill in.

Does this work? please advice,

if (cfValues['Opinion'] == 'Will do' &&  cfValues['Link to Release ticket'] !== 'null') return false; else return true;

Or

if (cfValues['Decision'] == 'Will Implement' &&  cfValues['Link To Release ticket'] !== 'null'); 

else

(cfValues['Decision’]*.value in [‘will not’, ‘future’]  &&  cfValues['Link To Release ticket'] == 'null');

Thanks.

2 answers

1 accepted

2 votes
Thomas Schlegel Community Champion Feb 13, 2017

Hi,

this might help you: 

(cfValues['Opinion']?.value == 'Will do' && cfValues['Value'] != null) || (cfValues['Opinion']?.value == "Will not do") || (cfValues['Opinion']?.value == "future")

Thomas, 

Really appreciated! this script exactly works, 

I was wondering from where do I start learning Groovy Script and improve my stuff

Thanks a lot for the help!    

Thomas Schlegel Community Champion Feb 14, 2017

you're welcome smile

Hey Thomas

How to

Validate a Confluence Link During Transition,

any groovy script for that.. help needed

Thanks

 

Hi Thomas,

I have to make a field required based on the value in another field. We have scriptrunner add-on. What is the simplest and best way to achieve this?

Can you provide me a sample syntax for  this logic?

IF dropdown_field = option3 or option4 then Text_field =Required END IF

0 vote
Thomas Schlegel Community Champion Feb 10, 2017

Hi,

maybe this will help you: https://answers.atlassian.com/questions/267139

Regards,

Thomas

Thank you for help! I tried to write a script but this does work, can you please look it

please advice me. 

if (cfValues['Opinion'] == 'Will' && cfValues['Link To Release ticket'] !== 'null'); 

else

(cfValues['Opinion'] == 'Will Not or Future’ &&  cfValues['Link To Release ticket'] == 'null');

Thomas Schlegel Community Champion Feb 12, 2017

did you try the step-by-step-guide in the page, I linked to? This is exactly what you need, I don't know what to explain any more than that.

Thomas, Thank you for the reply, The scenario in the link he said to use Two Transitions as State 1 and State 2  but 

In here I need to achieve those only during One Transition by the validator, I experimented all those scripts in that link doesn't work for me, can you please help me with script!! I'm a beginner in GrovvyScipt. 

Thanks.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jun 14, 2018 in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

503 views 3 5
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