How to set incident state is "WIP" automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 05:44 AM
Hello expets
We have requirment.
We have a field is Due date. If below conditions are met field will be visible. or else Hide.
Requirement is
Incident should switch back to WIP as soon as the set date/time is reached.
Please support to achieve this
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 11:27 PM
Thank you for your Quick reply ,
My Current time is - 12.52 IST.
Postpone shedule - 022-11-16 12:48:00
Sry ! i tried above code but unfortunately not working. Please correct me if any wrong.
This is the requirment msg from my client.FYI.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 11:40 PM
I already told you can write script but testing will be tricky as you should open the form at the exact second which is present in date/time field.
Script I shared will work fine but testing is difficult.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 11:45 PM
Hi@Ankur Bawiskar,
Once again Thank very much for your Quick reply and support!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 04:41 AM
Hi@Ankur Bawiskar,
Sry for disturbing again!.
I was looking some articles in community i got a clue using scheduled job we can achieve our requirment.
able-"incident"
field name - "u_postpone_schedule"
In Progress value - "2"
On Hold value - "3"
state - "state "
so i tried below code but not working can u help me on this.
NoTE:Based on date need to change the state from ON Hold to IN PROGRESS " Time no need to consider.
var gr = new GlideRecord("incident");
gr.addActiveQuery();
gr.query();
var today = new GlideDateTime().getDate();
while(gr.next()) {
var postpone = gr.getValue("u_postpone_schedule");
var gdt = new GlideDateTime(postpone);
if(gdt.on(today)) {
gr.state=2;
gr.update();
}
}
Please correct me
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 01:59 AM
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