Highlighted
Absent Member.
Absent Member.
336 views

Auto Closure Rule for closing the Incident Not working

Hi Experts,

I have built the below rule for the autoclosure of the Incident after a specified time but it is no working. Below is the description of the code written..

Step 1:Use the below JS

function AutoCloseIM()
{
var ticket = new SCFile("probsummary");
var rc = ticket.doSelect("problem.status=\"Resolved\" and resolved.time<tod() - ' 00:10:00'");

if (rc == RC_SUCCESS)
{

do {
//ticket.resolution_code = "Automatically Closed";
ticket.doAction("close");
} while (ticket.getNext() == RC_SUCCESS);
}
}
AutoCloseIM();

Step 2: Save this script in SL under name AutoCloseIncident

Step 3:Creata a Rule as follows

Run JavaScript Validation

To call the script :system.library.AutoCloseIncident.AutoClose(00:30:00);

 

Step 4: Attach the Rule for On Enter and On Successful Update.

But above scenario is not working. I have copied the above code from community it self, it looked good so no modification done.

 

Please suggest

-DK

 

 

 

0 Likes
5 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Auto Closure Rule for closing the Incident Not working

From your JavaScript, I don't see a function called AutoClose.  It seems like all you need to do is just call the JavaScript itself and it'll run AutoCloseIM() at the end.  On that note, maybe you just need to call:

system.library.AutoCloseIncident

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Auto Closure Rule for closing the Incident Not working

Hi Tom,

Thanks for the reply.

The Issue was that the OOB Syntax of system.library function is

system.library.scriptname.functionname

This is now working and Script is getting executed.B

Now it is throwing another Error as follows

Invalid syntax for query. Failed parsing (Ruleset.run,run.javascript)

problem.status="Resolved" and resolved.time<tod() - ' 00:10:00' (Ruleset.run,run.javascript)

I don 't see any Issue in the syntax, DO you have any suggestion

 

-DK

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Auto Closure Rule for closing the Incident Not working

That query is in RAD language and you need to change it to Java Script. For example, problem.status should be problem_status and resolved.time should be resolved_time. 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Auto Closure Rule for closing the Incident Not working

Hi Tom,

I tried your suggestion but it is giving invalid syntax Error

There seems to be some Issue with the Later Part of the Expression

resolved.time>tod()-'00:10:00'.

This is not getting parsed.. 

-DK

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Auto Closure Rule for closing the Incident Not working

try changing tod() to system.functions.tod()

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.