Forums

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

cfValues script in Post function

Bunty
Contributor
February 6, 2019

Hi All,

How to add two custom field(single select) values in single cfValues script ??

I'm trying to create a two sub tasks automatically when parent issue is created based on custom field values selection.

we have a custom field(single select list) called "Test" it has options A, B, C, and D and i want put a condition that if user selects either B or C while creating parent issues it has to create sub-tasks automatically. If user selects option D or A sub-tasks should not create.

I've added Create sub-task(Script runner) post function and added below condition

cfValues['Test']?.value == 'B'
cfValues['Test']?.value == 'c'

Sub-tasks are creating only when option B is selected. I want to add both values B & C in single line.

I've tried with below script it is not working:

cfValues['Test']?.value == 'B, C'

Any help??

Thanks in Advance,

Bunty

 

1 answer

0 votes
fjodors
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.
February 7, 2019

Hi

Did you try to use getValue() method?

I use such code in transition validator, try something similar in post function

result=true
if (cfValues['<selectListCustomField>'].getValue() == "Yes") {
    result=false;
}
return result;
Bunty
Contributor
February 7, 2019

Hi @fjodors,

Thanks for the reply!

successfully created sub-tasks using "OR" operator

cfValues['MTS Issue Type']?.value == 'B' || cfValues['MTS Issue Type']?.value == 'C' 

Like Mike Wingfield likes this

Suggest an answer

Log in or Sign up to answer