Highlighted
Honored Contributor.
Honored Contributor.
670 views

Old Interactions that never closed with related Incidents

We are using SM 9.33 with PD4 and found almost 600 SD incident records that are still in Dispatched status despite the IM being closed. Does anyone have any suggested cleanup methods or complex updates that I could run to get them to close out?

Any suggestions would be greatly appreiciated.  

0 Likes
6 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Old Interactions that never closed with related Incidents

Hi, May be you can use Mass closure functionality or even can write a JS code to close SD tickets.( SD.closeme() ).
Cheers,
Hardit Singh
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Old Interactions that never closed with related Incidents

There is 2 methods:

1) use JS (common scheme- take SD search relaited IM for it and if IM closed then will close SD)

2) use sql command in DB for same action (MS-SQL or Orcle,...)

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Re: Old Interactions that never closed with related Incidents

Do you have any suggestions for how I could write that in JS?

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Old Interactions that never closed with related Incidents

You can come up with and write something like this:

 

var SD="";
var IM="";
var relationFile = new SCFile("screlation"); 
var TargetIMFile = new SCFile("probsummary");
var TargetSDFile = new SCFile("incidents");

var findIMRecord1 = TargetIMFile.doSelect('status="Closed"');
if (findIMRecord1 == RC_SUCCESS)
	{
	do
		{
		IM=TargetIMFile.source;
		var findIMRecord2 = relationFile.doSelect('depend.filename="incidents" and source="'+IM+'"');
		if (findIMRecord2 == RC_SUCCESS)
			{
			SD=relationFile.depend;
			var findRecord3 = TargetSDFile.doSelect('status~="Closed" and incident.id="' + SD +'"');
			if (findIMRecord3 == RC_SUCCESS)
				{
				TargetSDFile.status = "Closed";
				TargetSDFile.doUpdate();
				}
			}
		}
	while ( TargetIMFile.getNext() == RC_SUCCESS );
	}
0 Likes
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: Old Interactions that never closed with related Incidents

You'd want to start with the relationship file (screlation) and work from there. Going through all IMs is very inefficient.

Alternatively, if there is an issue with closure that prevented correct screlation records, you would want to go through all open SDs, and check if the related IM(s) is/are all closed.

 

EDIT:

Also, do not use SQL, as there are application triggers that "do stuff" as part of the closure. These will not fire if you go through SQL. Unless you are familiar with what happens, and you either do that manually or wish to avoid it.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Old Interactions that never closed with related Incidents

No problem to modify the script to fit your needs. Here is an example of organization of data updates.

var SD="";
var IM="";
var relationFile = new SCFile("screlation"); 
var TargetIMFile = new SCFile("probsummary");
var TargetSDFile = new SCFile("incidents");

var findRecord1 = TargetSDFile.doSelect('status~="Closed"');
if (findRecord1 == RC_SUCCESS)
{
	do
	{
		SD=TargetSDFile.incident_id;
		var findIecord2 = relationFile.doSelect('depend.filename="problem" and source="'+SD+'"');
		if (findIecord2 == RC_SUCCESS)
		{
			IM=relationFile.depend;
			var findRecord3 = TargetIMFile.doSelect('status="Closed" and number='+IM+'"');
			if (findRecord3 == RC_SUCCESS)
			{
				TargetSDFile.status = "Closed";
				TargetSDFile.doUpdate();
			}
		}
	}
	while ( TargetSDFile.getNext() == RC_SUCCESS );
}
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.