Where to find closeRelatedTasks(current);

Aman Gurram
Giga Expert

Hello All,

I am trying to find the body of the function closeRelatedTasks(current); in the below business rule

Name: SNC - ITIL - Resolve Related Incidents         (Global)

Script:

if (current.problem_state.changesTo(4))

{

      resolveRelatedIncidents(current);

    closeRelatedTasks(current);

}

//

// Resolve any incidents that are related to the current problem

//

function resolveRelatedIncidents(me)

{

      var incident = new GlideRecord("incident");

      incident.addQuery("problem_id", "=", me.sys_id);

      incident.query();

      while (incident.next()) {

      if ( incident.active == true )

    {

                  ............................................

                  ...........................................

                  ............................

                  incident.state.setValue(6);

                  incident.comments = msg;

                  incident.update();

    }

  }

}

The business rule gets executed without any errors when a new problem is inserted or updated in the Problems table. When the function is not defined in the first place, I am wondering from where is the function closeRelatedTasks(current); is getting executed when its not defined in the first place. Any help is greatly appreciated.

5 REPLIES 5

Bharath40
Giga Guru

Hi Aman,



By default this BR is set to active false.


But I need the function Body of CloseRelatedTask();  


I wonder where it's hiding  


Aman Gurram
Giga Expert

After digging some concepts of Global business rules, found that



The body of the function CloseRelatedTask(current);


is located in SNC - ITIL - Close Related Global Business rule which is defined on Global Table



->Global business rules are business rules where the Table field is set to Global. Global business rules may be accessible on multiple tables and from other scripts, depending on their scope protection.



->Using global business rules allows the creation of functions that can be used anywhere in the system.


I had no idea you could do that. Huh. Thanks for this info!