Want to make all checklist mandatory on HR Task

Nivedita
Mega Expert

Hello All,

I have created an HR Task in preboarding which is regarding software set up. I have 7 checkboxes I want that once all the checkboxes are true then only "assigned to person" should be able to close the case.

find_real_file.png

1 ACCEPTED SOLUTION

Susan Britt
Mega Sage
Mega Sage

You have two separate requirements here.  1 - verifying all checklist items complete and 2 - limiting who can close the task.

For the first, see if https://community.servicenow.com/community?id=community_question&sys_id=0f96ece5db8e9850fb115583ca96... helps you.

For the second, is this restriction only for this one particular task or all of your HR tasks?

View solution in original post

2 REPLIES 2

Susan Britt
Mega Sage
Mega Sage

You have two separate requirements here.  1 - verifying all checklist items complete and 2 - limiting who can close the task.

For the first, see if https://community.servicenow.com/community?id=community_question&sys_id=0f96ece5db8e9850fb115583ca96... helps you.

For the second, is this restriction only for this one particular task or all of your HR tasks?

Ravi sah
Tera Contributor

Hey Nivedita,

Create a Business rule which runs before update and is on HR task table, and use the filter condition as HR task type is checklist and state changes to close complete.

 

use the below given Business rule script:

 

(function executeRule(current, previous /*null when async*/) {
 
 
var check_List= new GlideRecord('checklist');
if(check_List.get('document',current.sys_id)){
var checklist_itemGr = new GlideRecord('checklist_item');
checklist_itemGr.addEncodedQuery('complete=false^checklist='+check_List.sys_id); //get the chceklist item of the current checklist item.
checklist_itemGr.query(); 
if(checklist_itemGr.hasNext()) {
 
 
current.setAbortAction(true); // do not let the user submit the task if he has not checked all the checklist items.
}
gs.addErrorMessage('All checklist items must be completed before submission.'); //display the infor message if all checklist items are not checked.
}
 
})(current, previous);