how do I limit the time of when a user can reopen an incident i.e. after 30 days they can't reopen?

btreseder
Kilo Expert

how do I limit the time of when a user can reopen an incident i.e. after 30 days they can't reopen?

1 ACCEPTED SOLUTION

Sorry, i think i made a blunder here. I reversed the operator



replace this line


if(difference < thirtyDays )




with this




if(difference > thirtyDays )




I just cross checked it on a demo instance, it seems to work fine there


-Anurag

View solution in original post

21 REPLIES 21

Anurag Tripathi
Mega Patron
Mega Patron

Hi Brenda,



On the Reopen ui action add the condition that if closed date is less than 30 days   then only it should be visible. You might need a script to build this condition.


-Anurag

condition on ui action will be something like this



javascript: new ReopenCondition().reopentask()



Create a script include



Name - ReopenCondition


client callable - true



SCRIPT -



var ReopenCondition= Class.create();


ReopenCondition.prototype = Object.extendsObject(AbstractAjaxProcessor, {


reopenIncident: function()


{


var thirtyDays = 30*24*60*60;


var closedTime = incident.closed_at.getDisplayValue();


var currentTime = gs.nowDateTime();


var difference = gs.dateDiff(closedTime ,currentTime,true);


If(differentce <thirtyDays )


{


return false;


}


else


{


return true;


}


}


});


-Anurag

Anurag,


Here is what I was doing but the script seems to have errors and I just copied and pasted yours. Can you look at your script again please? Am I doing this correctly? I haven't done many of these. Thanks for your help.



001.png@01D01EA7.1274CA80


So I already have a Reopen Incident ui action and the current condition there shows current.incident_state == 9 and a script as follows:


current.incident_state = 8888;


if(current.isValidRecord()) {


// this is when close is called as an update, just update it


current.update();


} else {


// and insert the record


current.insert();


}



So where do I put the condition you suggested?   Do I add it below the current condition?


Then I create the script include separately, correct?