- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 03:34 AM
Hi,
I need to close the problem ticket if its in resolved state for last 14 days.
Can someone please guide me to achieve this.
Thanks,
Priyanka
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 08:08 AM
Thanks everyone my script is working now as i have just compared two dates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 03:42 AM
Hello @Priyanka77
You need to create a Flow Designer for that.
Where you can select Wait for Condition till 14 Days.
to trigger the change.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 03:47 AM
Thanks @Samaksh Wani for your response
But instead of creating complete flow can we design this functionality through business rule or schedule job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 04:47 AM
Hello @Priyanka77
See Priyanka, The BR will work only when the certain criterial of form met suppose no one have not opened the form or met the criteria after 14 day, it will not get execute.
Also for creating a Automatic update the right way is to use Flow Designer.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 03:50 AM - edited 07-19-2023 03:54 AM
Hello @Priyanka77 ,
Create schedule job and write below script in that run it on daily basis
updateRecords();
//It would check if the days between Resolved and now time is more than 14 working days i.e. the difference is excluding weekends.
function updateRecords() {
try {
var prbGR= new GlideRecord('problem');
prbGR.addQuery('state', 6); // 6 = Resolved *make changes based on your value
prbGR.query();
while (prbGR.next()) {
var start = new GlideDateTime(prbGR.resolved_at);
var nowTime = new GlideDateTime();
var days = getDateDiffExcWeekends(start, nowTime);
// if days more than 14
if (days >= 14) {
prbGR.state = 10; //closed
prbGR.active = false;
prbGR.update();
}
}
} catch (ex) {
gs.info(ex);
}
}
Kindly mark Correct and Helpful if applicable