Need to update the createdby & updated by
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 11:40 AM
Hello All,
Thorough the script I want to update the created by & updated by forcefully.
I was trying like below
gr.sysAutofield(false);
gr.sys_created_by = 'Test';
gr.updated_by = 'Test';
However, created on & updated on & updated or not getting updated & showing empty.
My requirement is to update only createdby & updated by with "Test". It should not impact on created on & updated on.
is it possible? if yes, can you help me with the code.
Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 12:02 PM
gr.sys_created_by = 'Test';
gr.sys_updated_by = 'Test';
// I dont think you need this - > gr.autoSysFields(false); //Do not update gr.autoSysFields(false); //Do not update system fields
gr.setForceUpdate(true); //Force the update
gr.setUseEngines(false);
gr.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 10:20 PM - edited 12-08-2023 10:21 PM
Hello Vinay,
Try with below code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 10:22 PM
HI @Vinay49 ,
I trust you are doing great.
Here's the sample code:
var gr = new GlideRecord('your_table_name'); // Replace 'your_table_name' with the actual table name
gr.addQuery('your_query_field', 'your_query_value'); // Replace with your query parameters
gr.query();
if (gr.next()) {
gr.autoSysFields(false); // Disables auto-updating of system fields
gr.sys_created_by = 'Test';
gr.updated_by = 'Test';
gr.update(); // Saves the record with the new values
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi