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

Popup message on closed incomplete of task on RITM

Pratiksha KC
Tera Guru

When one of Catalog Tasks related to RITM is Closed Incomplete, the state and stage on RITM should be automatically set to State = Closed Incomplete. Any other related to this RITM Catalog Tasks that are in progress (active) should be set to state = Closed Incomplete. Additionally, I want a pop-up message is displayed. Pop-up for closure to enforce proper usage of close incomplete status.
Pop up message: 'If you close this task as Closed Incomplete the Requested Item will be cancelled. Are you sure you want to cancel the Requested Item? Please note that all associated Catalog Tasks that are in progress will be cancelled as well.' Pop up should be displayed when user select State = Closed Incomplete on Catalog Task.

Soultion should be applied to backend and SOW>

6 REPLIES 6

UPPADAM
Tera Contributor

Hi @Pratiksha KC ,

Statement of Work:

Requirement: Implement validation and cascading logic for Catalog Task closure.

Solution:
A client script prompts the user when "Closed Incomplete" is selected.
A business rule sets the associated Requested Item (RITM) and all other active tasks to "Closed Incomplete."
Ensures process integrity and avoids orphaned open tasks.

Scope Includes:
Change to Catalog Task behavior
Updates to associated RITM and sibling Catalog Tasks
Preventive confirmation before critical status change

 
Client script:

UPPADAM_0-1750972889688.png

Business rule:

UPPADAM_1-1750972927157.png

Business Rule Script:

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

    // Add your code here
  var ritm = current.request_item;

  if (!ritm) return;

  // 1. Update RITM to Closed Incomplete if not already
  if (ritm.state != 4) {
    ritm.state = 4; // Closed Incomplete
    ritm.stage = 'closed';
    ritm.update();
  }

  // 2. Cancel other active Catalog Tasks of same RITM
  var otherTasks = new GlideRecord('sc_task');
  otherTasks.addQuery('request_item', ritm.sys_id);
  otherTasks.addQuery('sys_id', '!=', current.sys_id);
  otherTasks.addQuery('active', true);
  otherTasks.query();

  while (otherTasks.next()) {
    otherTasks.state = 4; // Closed Incomplete
    otherTasks.active = false;
    otherTasks.update();
  }

})(current, previous);


Note: Please check the field name according to your instance.

Please Mark : Correct if this solves your query and also mark: Helpful if you find my response worthy based on the impact.

Regards,
Mahesh Babu Uppada 


Hi @UPPADAM , Thanks for the reply.

 

Can we do this using flow designer? we already have running flow on catalog.

Hi @Pratiksha KC,

Yes, this can be done using Flow Designer. Set the trigger condition to "Service Catalog" and after defining all necessary conditions, based on your condition add an "Update Record" action:

  • In the action input, select the Requested Item record

  • Choose the table as Requested Item

  • Set the Stage & State field values "closed complete" or "closed incomplete" 

It's not possible to display error or info messages directly from Flow Designer. To show popup messages, you'll need to use a Client Script.

If my response solves your query, please marked helpful by selecting Accept as Solution and Helpful. 

Hi @prerna_sh 

Thank you for your response!
We already have an existing flow running, and I'm a bit confused about how to modify it to achieve our goal. Could you please help me understand how to trigger and check our specific condition within the existing flow?

I'll attach the screenshots for reference.

 

PratikshaKC_0-1751288952598.pngPratikshaKC_1-1751288969254.png