complted tasks are also getting changed to closed incomplete if request is cancelled.

Debasis Pati
Tera Guru

Hello All,

I saw one scenario where if i cancel a request which has completed tasks and work in progress catalog tasks for all the tasks it makes as closed incomplete.
where i want it should not close incomplete the closed completed tasks it should only update the incomplete tasks(active true) to closed incomplete.

where is this oob behaviour present which makes this changes?

@Ankur Bawiskar  any suggestion on this?

8 REPLIES 8

Hello @Ankur Bawiskar ,
I found this business rule earlier but SNC.Request i am not able to find what it is and where the closure script is written .

@Debasis Pati 

that script include is coming from platform level.

Did you deactivate that and see if it's not happening?

If it's not then that's the BR and you can keep it active=false and have your own logic.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@Debasis Pati 

that BR is the culprit, I just verified this by deactivating it.

When REQ is Closed Cancelled, it moves RITM to "Closed Incomplete" and SC Task also

As mentioned earlier

-> keep that OOTB BR active=false and have your own logic in another after update BR on REQ

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

ChallaR
Mega Guru

Hi @Debasis Pati .

Identify the Source of the Behavior

1. Check Business Rules on sc_req_item (Request Item Table)

  • Go to System Definition > Business Rules.
  • Filter by Table = sc_req_item.
  • Look for rules with names like:
    • Cancel Request
    • Update Task States
    • Close Catalog Tasks
  • Open each rule and check the Script section for logic that updates sc_task records.

2. Check Business Rules on sc_task (Catalog Task Table)

  • Same steps as above, but filter by Table = sc_task.
  • Look for rules that trigger on update or state change.
  • See if any rule is setting state = Closed Incomplete without checking if the task is already Closed Complete.

3. Check Workflows or Flow Designer Flows

  • If your catalog item uses Workflow:
    • Go to Workflow Editor.
    • Open the workflow associated with the catalog item.
    • Look for a "Cancel Request" or "Close Tasks" activity.
  • If using Flow Designer:
    • Go to Flow Designer > Catalog Item Flows.
    • Open the flow tied to the item.
    • Look for steps that update task states.

4. Check Script Includes or UI Actions

  • Go to System Definition > Script Includes.
  • Search for keywords like cancel, closeTasks, updateTaskStates.
  • Also check UI Actions on sc_req_item that might trigger cancellation logic.

FIX ----

Once you find the script or flow that updates task states, modify the logic like this:

 
var taskGR = new GlideRecord('sc_task');
taskGR.addQuery('request_item', current.sys_id);
taskGR.query();
while (taskGR.next()) {
   if (taskGR.active == true && taskGR.state != 3) { // 3 = Closed Complete
      taskGR.state = 4; // 4 = Closed Incomplete
      taskGR.update();
   }
}

NOTE -

This ensures only active and incomplete tasks are updated.

 

Please mark as complete and close the thread if this is helpful.

 

Thanks,

Rithika.ch