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.  

  • Hi, May be you can use Mass closure functionality or even can write a JS code to close SD tickets.( SD.closeme() ).
  • 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,...)

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

  • 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 );
    	}
  • 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 );
    	}
  • 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 );
    	}
  • 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.

  • 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 );
    }