- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 06:53 AM
how do I limit the time of when a user can reopen an incident i.e. after 30 days they can't reopen?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2014 07:39 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 06:56 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 07:32 AM
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;
}
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 09:54 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 10:12 AM
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?