- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 02:22 AM
HI service now team,
I am trying to Update date /time fields value on a closed incident through background script , but iam unable to update them through the background script i have written . but iam unable to acheive any results , can you correct my script if there is anything wrong or suggest me good scripting for updating the fields.
iam trying to update this fields
Restore date (empty field value to )==>Mar-18-2022 10:10:00 PM,
Actual End date (existing old value)==> Mar-18-2022 11:05:00 PM
var work_end = "03-18-2022 10:10:00";
var u_user_services_restored_date_ = ' ';
var gr= new GlideRecord('incident');
gr.addEncodedQuery('u_major_incident=true^incident_state=7^number=INC3486819');
//gr.setLimit(2);
gr.query();
while(gr.next())
{
gr.work_end = gr.getDisplayValue();
gr.setValue("work_end",'03-18-2022 11:05:00');
gr.setValue("u_user_services_restored_date_",'03-18-2022 10:10:00');
gr.setWorkflow(false);
gr.autoSysfields(false);
gr.Update();
}
Can any one of you could help me in this and provide me a good solution. thanks .
Regards,
Ghouse sharief
Solved! Go to Solution.
- Labels:
-
Major Incident Management