How to restricted the system updated fields when any record get updated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 05:53 AM
Hi All,
I want to update the few records in the table but it should not update the system fields like updated.
Please any one suggest me how to do this one,
Thanks,
Vinuth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 06:33 AM
Hi @vinuth v ,
Please use API autoSysField(false);
To get more details please follow below links:
Can we update system fields like 'Updated by' and 'Created by' from some old value to a new value th...
GlideRecord Query Cheat Sheet – ServiceNow Guru
Please mark helpful & accept answer if its worthy for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2024 04:22 AM
Hi @vinuth v ,
You can try something as below,
try {
var gr = new GlideRecord('incident');
gr.addEncodedQuery('state=1'); // queries for state new
gr.setWorkflow(false); // stops the running of any business rule or sending out any notification
gr.autoSysFields(false); //stops the updation of fields like created by or updated by
gr.query();
while (gr.next()) {
gr.description = "Testing";
gr.update();
}
} catch (e) {
gs.print('error' + e);
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang