- 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-24-2014 01:49 AM
Hi Brenda,
Create a NEW script include
Name - ReopenCondition
client callable - true
SCRIPT -
var ReopenCondition= Class.create();
ReopenCondition.prototype = Object.extendsObject(AbstractAjaxProcessor, {
reopentask: 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(difference < thirtyDays )
{
return false;
}
else
{
return true;
}
}
});
Now in your ui action REOpen you already have this as the condition
current.incident_state == 9
Now write this ni the condition part
current.incident_state == 9 && (new ReopenCondition().reopentask())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2014 07:17 AM
I've done what you suggested but it didn't work. I opened a closed incident and the button is still there and it was closed over 30 days ago.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2014 07:20 AM
there is an oob field on incident "Closed" what is the value on that field?? I wrote my script on that field.
var closedTime = incident.closed_at.getDisplayValue();
If you are using any other field to check the date on which it was closed use that field in this line in the place of "closed_at"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2014 07:25 AM
Ours is also 'closed_at' for the value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2014 07:28 AM
and when you open and again close the incident...i think this value will get the current date time....The Incident you tested this, can you check what value does this field have for it.