How do I retreive the valuees checked in a multi-value checkbox?

Chris Shaw May 9, 2023

Hello, I have a checkbox called "Risk Assessment" with two possible values, "Security Risk" and "Licenses Risk". I require both values to be checked before a workflow can transition to the next (final) state. How can I do this? I have successfully used the Power apps and SIL code for validators before, and for this I tried:

string[] checkbox = gadget_getMultiValues(argv, "Risks Assessed");

if( arrayElementExists(checkbox,"Security Risk") && arrayElementExists(checkbox,"Licenses Risk") ) {
return true; }
else {
return false, errMsg; }

but it's not working. I've examined the checkbox array and it always seems empty, and the argv array, which has numbers in it? Has anyone got gadget_getMultiValues to work for checkboxes, or know of a way that works?

1 answer

1 vote
Anna Hryhoruk _Appfire_
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.
May 18, 2023

Hello @Chris Shaw ,

Do you still need help with it? 

There are a few things that are not clear to me. Is your checkbox a Jira native checkbox field? Also, I assume this checkbox custom field is located on the transition screen, and you need a validator to check that all those values in the checkbox are selected. Is that correct? 
I am unsure if my understanding is correct because you mentioned gadget_getMultiValues which is the SIL Runner Gadget routine, and I cannot understand how to connect the gadget to this scenario. So please correct me if my understanding of the general picture and use case is wrong. 

But meanwhile, I`ll provide you with a validator example that matches the scenario per my understanding. 

string errorMsg = "The field Risks Assessed must have all values checked!";
string val = getInput("Risks Assessed");

if(contains(val, "Security Risk|Licenses Risk")) {
return true;
}else {
return false, errorMsg; }

This will allow you to transit only if you have those two checkboxes Security Risk and Licenses Risk checked. But if your checkbox may have some other 3d, 4th, etc options and you want to allow as many checkboxes as the user selects but Security Risk and Licenses Risk are obligatory, you need to use the following instead of line 3

if(contains(val, "Security Risk") and contains(val, "Licenses Risk") ) {

 If this doesn`t match your needs, please answer my above questions and I will try to help you. 

Best regards,
Anna

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.20.11
TAGS
AUG Leaders

Atlassian Community Events