
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 10-20-2019 09:11 PM
Checklists are cool but they're horribly underutilised. They're a great way of reducing the number of tasks involved in a process and can be set up from Flows.
Here's the code for a checklist utility that can be called from business rules, UI actions and Flows. The two functions are:
- Create (pass the sys_id for the record and a comma separated list of your checklist items)
- isComplete (pass the sys_id for the record to see if the checklist has been completed)
var checklistHelper = Class.create();
checklistHelper.prototype = {
initialize: function() {
},
//////////////////////////////////////////////
create: function(table, sys_id, items){
var checklistID;
var check = new GlideRecord('checklist');
check.setWorkflow(false);
if (!check.get('document', sys_id)) {
check.document = sys_id;
check.table = table;
checklistID = check.insert();
}else{
checklistID = check.sys_id.toString();
}
for (var i = 0; i < items.length; i++) {
var checklistItem = new GlideRecord('checklist_item');
checklistItem.setWorkflow(false);
checklistItem.initialize();
checklistItem.checklist = checklistID;
checklistItem.complete = false;
checklistItem.name = items[i];
checklistItem.order = i;
checklistItem.insert();
}
},
//////////////////////////////////////////////
isComplete: function(sys_id){
var checklistComplete = true;
var check = new GlideRecord('checklist');
if(check.get('document', sys_id)) {
var checklistItem = new GlideRecord('checklist_item');
checklistItem.query('checklist',check.sys_id);
while(checklistItem.next()){
if(!checklistItem.complete){checklistComplete = false;}
}
}
return checklistComplete;
},
type: 'checklistHelper'
};
Then from a business rule, it's really easy to check to see if someone has completed their checklist.
(function executeRule(current, previous /*null when async*/) {
var myCheckList = new checklistHelper();
var checklistFinished = myCheckList.isComplete(current.sys_id.toString());
if(!checklistFinished){
current.setAbortAction(true);
gs.addErrorMessage('You cannot close this task until the checklist is complete');
}
})(current, previous);
Now we've got our code sitting in a Script Includes we can use it anywhere, including in Flows. So here's a custom action that was added to allow a checklist to be added to any record in a flow.
Then when you create tasks in a Flow you can quickly and easily add a checklist to the tasks you're creating along the way.
I've included the flow action and all of this code in the attached update set (JDS) Checklists, so try it out in your development instance.
Have fun
- 2,457 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Peter,
We have checklist enabled on the sc_task form but the checklist is only being used in 2-3 catalogs.
Any way we can hide the checklist field from 1 sc_task and leave it available on another?
Thanks,
Gurbir
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I would like to run the checklist isComplete function in a client side script every time an item in a checkbox is checked, however I cannot select "Checklist" from the field name when creating an onChange event:
Is there any way to check this client side when items are checked? If so, how?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Super helpful. Saved a few hours for me 🙂
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks its useful and getting better knowledge on checklist . Have doubt on Business rule Step, what is the trigger condition ? and on which table we are creating this business rule? @petercawdron
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Terje Monsen did u find your answer for getting checklist field ?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Can you build a report for checklists? Have looked in the PPM Task table and can't find a field to use

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@petercawdron , How to get the selected Checklist items using onChange client Script ?
I want to display a confirm box upon selecting a "Select all" checklist item and check all checklist options.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@petercawdron When importing the Checklist Helper XML, there are several errors while importing. Just to be 100% sure, I redid a new PDI. Running on Utah if that helps...
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi, Can I enable checklist only for one single catalog Item and I want to enable this on RITM.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello @aradhanadub ,
Yes, we can enable the checklist only for one RITM. Below is the code:
Hopefully this gives you some ideas about how to publish checklist for a single RITM.
P.S. Please mark as helpful and/or correct if this answered your question.