ticket should close automatically after 30days from the day the status change to resolved

i want the incident ticket to close automatically after 30days from the day the status changes to resolved.

Please  help me with this

  • We wrote a script in the ScriptLibrary to do this, except for 7 days.  And a scehdule record that kicks off every night to check if the Inicdent has been resolved for at least 7 days.  When the schedule record sees the incident has been resolved for 7 days then the script kicks in and closes the incident. 

    So the schedule record on the javascript tab has this line to call the script:


    And then in Scriptlibrary we have a script called AutoCloseIncident that has this function:

    function AutoCloseIM()
       var ticket = new SCFile("probsummary");
       var rc = ticket.doSelect("problem.status=\"Resolved\" and resolved.time<tod() - '7 00:00:00'");
       if (rc == RC_SUCCESS)
          do {
              //ticket.resolution_code = "Automatically Closed";
          } while (ticket.getNext() == RC_SUCCESS);

    *** If you do this, you will need to think about incident tasks.  I have another post from the past couple days where I talked about our incidents were able to be resolved with open tasks.  So here is another thread you may want to look at: