Updated by field be populated with system

rajesh29
Tera Expert

Hello Everyone,

i have created Business Rule (Before) insert and update. when state is changed to Restored, it is filled with the time in Restored field.  please refer the below attached screenshot. but updated by field is  Populated with System.

how to stop the system updated by?I need to get instead of system who is update by the (user).

script:

condition: state changes to Restored

(function executeRule(current, previous /*null when async*/) {

var time = gs.nowDateTime();
current.u_restored = time;
current.autoSysFields(false);
//current.update();

})(current, previous);

 

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi @rajesh 

if you follow the recommendation not to invoke current.update() in a before Business Rule and if you also comment out the line with current.autoSysFields(false); then you should find in the "updated_by" the name of the user who triggered the update.

Kind regards
Maik

View solution in original post

3 REPLIES 3

Maik Skoddow
Tera Patron
Tera Patron

Hi @rajesh 

if you follow the recommendation not to invoke current.update() in a before Business Rule and if you also comment out the line with current.autoSysFields(false); then you should find in the "updated_by" the name of the user who triggered the update.

Kind regards
Maik

Thank you @Maik Skoddow 

Could you please clarify, is the below code is correct?

(function executeRule(current, previous /*null when async*/) {

var time = gs.nowDateTime();
current.u_restored = time;
//current.autoSysFields(false);
//current.update();

})(current, previous);

 

Thank you,

Rajesh B

Hi @rajesh 

to my mind it should. Just try it out!

Kind regards
Maik