Highlighted
Absent Member.
Absent Member.
353 views

How to check if there are any Open Incidents/Changes/Problems to stop closure of an Incident

Hi Experts,

I need to stop the closure of the Incident if there are any Open Records. Can someone please let me know how that can be achieved.

I found on help center the following method to close the related Workorders. Can I get some help to build similar Logic for other Tickets

Modify im.set.close Process definition

This process needs to be modified so that a user cannot close an incident if there are work orders still open for the incident.

To modify a process definition record, follow these steps:

  1. From the System Navigator, click Tailoring > Document Engine > Processes to open the Process Definition form.
  2. Type im.set.close in the Process Name field.
  3. Click Search.
  4. On the Initial Javascript tab, type the following JavaScript:

    var WO=new SCFile ("EXWorkOrder")
    var FoundOpenWO=WO.doSelect ("RelatedID=\""+system.vars.$L_
    file.number + "\""+" and status ~=\"" + "Closed" + "\""
    if (FoundOpenWO == RC_SUCCESS)
    {
    system.vars.$openWO=true;
    }
    else
    {
    system .vars.$openWO=false;
    }
  5. Click Save.
  6. On the RAD tab, enter the following information:

    Field Value Note: Some of the fields on the RAD tab are pre-filled with values that you do not need to modify RAD Application - Select the empty section below the section calling the RAD Application us.consume.wrapper and then enter the following information: Expressions evaluated before RAD call $L.text="There are still open work orders. This incident cannot be closed yet." RAD Application apm.mb.ok Condition $openWO=true Parameter Names text Parameter Values $L.text
  7. Click Save.
  8. On the Final Expressions tab, enter the following information:

    • if ($openWO=true) then ($L.exit="badval")
    • $L.exit="closestate"
  9. Click Save and then OK.

 

 

Here I am not able to understand what is this ""

system.vars.$openWO=true;

 

DO we have similar check points for other records.

Regards,

-HB 

0 Likes
6 Replies
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: How to check if there are any Open Incidents/Changes/Problems to stop closure of an Incident

It's usually helpful to do a search on this board before posting, to see if a thread has already given some tips. For example, this recent thread: http://community.hpe.com/t5/Service-Manager-Service-Center/Stop-Mater-Ticket-Closure-before-Child-Tickets-are-closed/m-p/6886234

That being said, I would do this with a calculation or a JavaScript on the probsummary formatctrl, to check if there are any open related records, and if there are establish a variable. Then in that same formatctrl, validate that variable on close.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to check if there are any Open Incidents/Changes/Problems to stop closure of an Incident

@AChandler

Thanks for the reply..

 

I had already checked the thread mentioned by you but that didn't worked.

Can you please help with JS you mentioned earlier

Regards,

-HB

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: How to check if there are any Open Incidents/Changes/Problems to stop closure of an Incident

Hi @HPSMBeginner, could you tell me what you are using for Workorders? Are they in the incident module, just named differently?

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: How to check if there are any Open Incidents/Changes/Problems to stop closure of an Incident

Well, I guess it may not matter which module your workorders are on. Try this first and see what it does:

Put this in the probsummary formatctrl on the Javascript tab, with Del set to true:

vars.$hasRelated = "NOPE"

var rel = new SCFile("screlation");
var q = "source=\"" + record.number + "\" and depend.active=true";

var relRc = rel.doSelect(q);

if (relRc == RC_SUCCESS) {vars.$hasRelated = "YEP"}

Then on the Validations tab, add a line with Del as true and the Validation saying

$hasRelated="NOPE"

Then test it out by trying to close an Incident that has an open workorder.

If your Workorders are in the IM module and you only care about open Workorders (no other open tickets) when closing an Incident, then use this for the JS instead (adding the table name should improve query time):

vars.$hasRelated = "NOPE"

var rel = new SCFile("screlation");
var q = "source=\"" + record.number + "\" and depend.active=true and depend.filename=\"probsummary\"";

var relRc = rel.doSelect(q);

if (relRc == RC_SUCCESS) {vars.$hasRelated = "YEP"}

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to check if there are any Open Incidents/Changes/Problems to stop closure of an Incident

@AChandler

 

I am not using workorders. I want the similar workflow to check any Open Incidents,Problem or Change Requests related to an Incident.

 

To simplify the Use case is as follows

If a User tries to close the Incident, and there are any open Incidents, Prolems or Change records related to that Incident, the system should throw an Error.

I found the snippet of the code in the helpcenter, but this is not meeting my requirement

 

-HB

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: How to check if there are any Open Incidents/Changes/Problems to stop closure of an Incident

OK, so try what I posted earlier.

In the probsummary formatctrl, put this JS on Delete:

vars.$hasRelated = "NOPE"

var rel = new SCFile("screlation");
var q = "source=\"" + record.number + "\" and depend.active=true and (depend.filename=\"probsummary\" or depend.filename=\"rootcause\" or depend.filename=\"cm3r\")";

var relRc = rel.doSelect(q);

if (relRc == RC_SUCCESS) {vars.$hasRelated = "YEP"}

then put a validation on Delete saying this:

$hasRelated="NOPE"

Then try to close an Incident which has an open IM or PM or C.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.