- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2023 03:42 AM - edited ‎03-20-2023 03:43 AM
To change state value to Open when custom date/time field (Reactivation Time) value matches with system date/time.
I am trying with below code, which is not giving the output.
Is there anything i am missing here ? Kindly Suggest
var gr = new GlideRecord('sn_hr_core_case');
gr.addEncodedQuery('state=30^u_reactivation_timeISNOTEMPTY');
gr.query();
while (gr.next()) {
var reopen_date = new GlideDateTime(gr.u_reactivation_time);
var today_date = GlideDateTime();
if (reopen_date == today_date) {
gr.state = '10';
gr.work_notes = 'Updated State to Reopen';
gr.update();
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2023 07:11 AM
if you are ok with Date then use scheduled job script.
If you are ok with minutes without thinking about seconds value then use flow designer.
But running flow every minute will lead to performance issue.
Please discuss with your customer about this.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2023 04:34 AM
workflow why?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader