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 11:45 AM - edited 12-08-2023 11:54 AM
Hi @Vinay49 ,
Try with the updated code.
gs.setWorkFlow(false)
gr.sysAutoField(false);
gr.sys_created_by = 'Test';
gr.sys_updated_by = 'Test';
-Thanks,
AshishKMishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 09:20 PM
Hi Ashish,
Thanks for your reply
gr.setworkflow(false) will stop executing of my other business rules?
Thanks
Vinay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 09:40 PM
The serWorkflow() method accepts one argument: a boolean true/false value. This argument will determine whether business rules should be triggered by any database actions performed by your GlideRecord script.
For example, if you make a change and call the update() method, calling setWorkflow() and passing in false will prevent any business rules that would normally be triggered by that update from running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 11:50 AM - edited 12-08-2023 11:51 AM
You need two fixes. Miss spelled autoSysFields and the updated by field name is sys_updated_by. You can also add setWorkflow to not run any business rule or workflow with this cange
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.sys_created_by = 'Test';
gr.sys_updated_by = 'Test';