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:12 AM
Hi Vinuth
Use *autoSysFields(false)".
BR,
Raphael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 06:39 AM
Hi @Raphael D_
I tried in the background script like
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 06:53 AM
Please try with below code:
var gr = new GlideRecord('incident');
gr.addQuery('number', 'INC0010006');
gr.query();
if (gr.next()) {
gr.short_description = "testvinuth12123434";
gr.setWorkflow(false); // Disable workflows to prevent updating system fields
gr.autoSysFields(false); // Disable automatic system fields updates
gr.update();
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2024 04:05 AM
Hi @vinuth v
please see the example from Maddysunil.
you have to use "gr.autoSysFields(false)" instead of "gr.sys_updated_on(false)".
You can't disable individual sys fields, just all of them.
BR,
Raphael