I want to enable a business rule that prevents a case from closing if there are still open tasks attached to the case. I have created the business rule but it seems there is another business rule that is overriding mine. Could you please assist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 02:18 AM
I want to enable a business rule that prevents a case from closing if there are still open tasks attached to the case. I have created the business rule but it seems there is another business rule that is overriding mine. Could you please assist.
- Labels:
-
HR Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 04:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 04:16 AM
Hi Sandeep
Thank you, I have enabled this business rule on my instance and disabled the one I created. However I am still able to close a parent case with HR tasks still open. They all move to closed Incomplete.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2022 07:27 AM
Hi
I usually create a client script (since cannot change State via list) and script include to accomplish this. Here's an example, but please take into account if translations are needed for the alert or message that appears. This example does not.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue==3) { //Closed Complete
var ga = new GlideAjax('ICHRScriptInclude');
ga.addParam('sysparm_name', 'validateChildTasks');
ga.addParam('sys_id', g_form.getUniqueValue());
ga.getXML(setValues);
}
function setValues(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
if(answer == "true") {
alert("Please complete all of the child tasks before closing this case.");
g_form.setValue('state',oldValue);
} else {
g_form.setValue('state',newValue);
}
}
}
validateChildTasks: function(){
var sys_id = this.getParameter('sys_id');
var flag = false;
var taskRec = new GlideRecord('task');
taskRec.addQuery('parent', sys_id);
taskRec.addActiveQuery();
taskRec.query();
while (taskRec.next()) {
flag = true;
}
return flag;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 04:22 AM