The CreatorCon Call for Content is officially open! Get started here.

Checklist - check for completion before status change allowed ...

Zod
Giga Guru

Hi there,

we'd like to use the checklist templates on the incident form.

It would be quite good to force people to confirm (when trying to provide solution = state change) that there are still open checklist items ... .

Anything to be reused out there?

I think a client script on submit should be the most reasonable way ... other opinions?

1 ACCEPTED SOLUTION

Script Include:



var Test = Class.create();


Test.prototype = {


initialize: function() {


},




isChecked: function(id){


var gr = new GlideRecord("checklist");


gr.addQuery("document", id);


gr.query();


while (gr.next()) {


var gr_checkListItem = new GlideRecord("checklist_item");


gr_checkListItem.addQuery("checklist", gr.sys_id);


gr_checkListItem.addQuery("complete", false);


gr_checkListItem.query();


if (gr_checkListItem.next())


return false;


else


return true;


}


},




type: 'Test'


};





BR:


(function executeRule(current, previous /*null when async*/) {




var res=new Test().isChecked(current.sys_id);


if(res)


gs.addInfoMessage("Checklist is reviewed.");


else


gs.addErrorMessage("Please review the checklist.");




})(current, previous);


View solution in original post

5 REPLIES 5

Raju Koyagura
Tera Guru

We have similar requirement and achieved using script include and called that in one of our BR (update).


could u provide the script include code??? That would be helpful!


Thank you.


Script Include:



var Test = Class.create();


Test.prototype = {


initialize: function() {


},




isChecked: function(id){


var gr = new GlideRecord("checklist");


gr.addQuery("document", id);


gr.query();


while (gr.next()) {


var gr_checkListItem = new GlideRecord("checklist_item");


gr_checkListItem.addQuery("checklist", gr.sys_id);


gr_checkListItem.addQuery("complete", false);


gr_checkListItem.query();


if (gr_checkListItem.next())


return false;


else


return true;


}


},




type: 'Test'


};





BR:


(function executeRule(current, previous /*null when async*/) {




var res=new Test().isChecked(current.sys_id);


if(res)


gs.addInfoMessage("Checklist is reviewed.");


else


gs.addErrorMessage("Please review the checklist.");




})(current, previous);


very cool - thank you.


Only thing I do not like at the moment is, that I cannot use confirm in a Business Rule as far I know ... so I cant let the user decide if to abort or not ...