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";
} while (ticket.getNext() == RC_SUCCESS);

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