CheckBox Approvals - Workflow

ar1
Kilo Sage

Hi Team,

We have a requirement regarding checkbox approval:

we developed one catalog item and the catalog have 5 checkbox variables. and for each checkbox different users approval are there like below:

1. checkbox1 - A user approval

2. checkbox2 - B user approval

3. checkbox3 - C & D users approvals

4. checkbox4 - E & F users approvals

my requirement is :

if an end user select checkbox1 and chekbox3 in that case "A user" must approve and "C & D users" any one approval is enough no need to wait for both approvals.

ANY help would really appreciated...

thanks in advance..

Note: We used workflow and currently the ticket is waiting for all the user approvals [A , C , D] 

 

1 ACCEPTED SOLUTION

After both the Approved activity before set Value you have to use join acitvity 

like both the ends of approved will connect to join activity and then it will set the value to approved.

 

-------------Approval ------------  Join -------SetValue

------------Approval --------------

The join activity wait for the completion of all the paths.

Mark helpful and correct if it helps.

Thansk,

CB

View solution in original post

17 REPLIES 17

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use this sample script in the User Approval Activity

If more than 1 users then you can say anyone approves then request is approved

Anyone to approve:

Advanced checkbox - true

Script below

Note: please give proper variable names for those checkboxes

var answer = [];

if(current.variables.checkbox1 = true){
answer.push("PASS User A SYSID HERE");  
}
if(current.variables.checkbox2 = true) {
answer.push("PASS User B SYSID HERE");  
}
if(current.variables.checkbox3 = true) {
answer.push("PASS User C SYSID HERE"); 
answer.push("PASS User D SYSID HERE");  
}
if(current.variables.checkbox4 = true) {
answer.push("PASS User E SYSID HERE"); 
answer.push("PASS User F SYSID HERE");  
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Anukr,

Thank you so muchc for the reply..Plz check the below workflow.

 

find_real_file.png

 

1. if you look at the first RUN script named [check 1st level approval] here we mentioned checkbox1 and checkbox2 scripts

and in the approval user activity we gave conditions 

wait for  ->  Everyone to approval

 

2. Run script - >[check 2nd level approval]

we mentioned

checkbox 3 script

and user activity we gave

wait for -> Any one to approve

 

3. Run script - >[check 3rd level approval]

we mentioned

checkbox 4 script

and user activity we gave

wait for -> Any one to approve

In this scenario my requirement is working but  the approvals are not triggering at a time

Example: If  an end user select checkbox1 and checkbox3 and chekbox4.

 

Note: But we want to trigger all the approvers at a time and checkbox3 and checkbox4 approvers each one approval is  enough and checkbox1 approvals all must approve.

Please help us get out of this issue...

Thanks in advance.......

  

 

 

Hi Ankur,

Thanks for reply..

In the above script, If an end user select all 4 checkbox's, so in that time we want 

checkbox1 user approval 

checkbox2 user approval

checbox3 user approval [any one approval]

and 

checbox4 user approval [any one approval]

 

 

Advance thanks....

 

 

Hi,

if that is the case then as per suggestion from CB you would require multiple user approval activities.

You would require to have if activity for each checkbox and then set the approval user accordingly using script

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader