Need to update the createdby & updated by

Vinay49
Tera Expert

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

7 REPLIES 7

AshishKM
Kilo Patron
Kilo Patron

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

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi Ashish,


Thanks for your reply
gr.setworkflow(false) will stop executing of my other business rules?

Thanks 
Vinay

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.


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

SanjivMeher
Kilo Patron
Kilo Patron

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';

 


Please mark this response as correct or helpful if it assisted you with your question.