- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 04:41 AM
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);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 05:05 AM
Hi
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 05:05 AM
Hi
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 05:39 AM
Thank you
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 05:47 AM
Hi
to my mind it should. Just try it out!
Kind regards
Maik