Forums

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

cfValues script in Post function

Pankaj Sharma March 21, 2020

Hi All,

How to check one custom field( Checkboxes ) values in single cfValues script ??

I am trying to create a subtask automatically when parent issue is created based on custom field value selection.

we have a custom field( Checkboxes) called "Implementation Method" ,it has options A, B, C and D and I want to put a condition that if user select B and C while creating parent issue it should not create a subtask automatically.

If user selects option A or D, subtask should get created.

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

cfValues['Implementation Method'] != "B" && "C"

Sub-tasks is getting created even when option B and C are selected together.

Any help??

Thanks in advance

1 answer

0 votes
Aditya Sastry
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.
March 22, 2020

I would suggest to use other alternatives to create a sub-tasks. Script runner one isn't required for this simple requirement. However, you can use the below in your condition -

cfValues['Implementation Method'] != "B" || cfValues['Implementation Method'] !="C"

Let me know if this doesn't work!

Aditya Sastry
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.
March 22, 2020

You can use JMWE Create / Clone Issue(s) Post-function for this too. (Paid app)

Project -> Same as the current issue

Issue type -> Sub-tasks

Condition:

issue.getAsString("Implementation Method") == "A" || issue.getAsString("Implementation Method") == "D"

Pankaj Sharma March 23, 2020

@Aditya Sastry  I tried below script, not working apparently. Even when value B is selected, it creates a subtask which is not expected behaviour. 

cfValues['Implementation Method'] != "B" || cfValues['Implementation Method'] !="C"

JMWE has a cost involved so it will not be possible to buy at this point of time for my organization. 

Aditya Sastry
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.
March 24, 2020

Ok, so I looked into this and checkboxes work differently. This is the condition you should use - 

'A' in cfValues['Call-out']*.value || 'C' in cfValues['Call-out']*.value

Suggest an answer

Log in or Sign up to answer