
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2021 12:34 AM
How to update the created date ,by past 2 days ago from current date on incident .
For example if incident0123 created 23-03-2021 - 2 days =incident0123 created 21-03-2021
How to achieve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2021 01:53 AM
you can use this script to set the Created Date/Time 2 days from it's current Created Date/Time
var inc = new GlideRecord('incident');
inc.addQuery('number', 'INC001');
inc.query();
if(inc.next()){
var gdt = new GlideDateTime(inc.sys_created_on);
gdt.addDaysUTC(-2);
inc.sys_created_on = gdt;
inc.autoSysFields(false);
inc.setWorkflow(false);
inc.update();
}
Regards
Ankur
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-22-2021 04:12 AM
Hi,
So are you saying the script is working for admin but not for non-admin
can you share where have you written this script?
share the configuration screenshot as well
Regards
Ankur
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-22-2021 03:38 AM
Hi there,
When and where should this happen exactly? Is this a one time thing with background script? Or is it somewhere in your proces? Or within a workflow?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2021 03:42 AM
No they want when there is such kind of scenario it execute.
But We are stuck how to update the incident created by me and update days back -sys_created_on field.