- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 09:43 PM
Hello @Amit Gujarathi @shloke04 @Ankur Bawiskar
We implemented on change client script for one of the fields on the form to update value based on the another field. Working fine.
Note: Both are reference fields.
The requirement got extended and it was implemented on list view as well using the "on cell edit" client script since on change did not work on list view. And it is also working fine when updating the single record but when updating multiple records at a time from list, it's not working.
Is there any restriction while using on cell edit to update multiple records at a time? If no, please help me to update multiple records at at time from list.
Appreciate your help!
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 08:34 PM
@Ksnow ,
Yes this code should work . I have not provided the code for client script as we want a change over list as well as form.
This code will perfectly work at the server end . so whenever the record is updated this field will get auto fill.
Please refer below code for the same.
(function executeRule(current, previous /*null when async*/) {
// Check if Field 1 (User) is not empty
if (current.field1) {
// Get the user record
var userGr = new GlideRecord('sys_user');
if (userGr.get(current.field1)) {
// Set the company in Field 2
current.field2 = userGr.company;
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 08:34 PM
@Ksnow ,
Yes this code should work . I have not provided the code for client script as we want a change over list as well as form.
This code will perfectly work at the server end . so whenever the record is updated this field will get auto fill.
Please refer below code for the same.
(function executeRule(current, previous /*null when async*/) {
// Check if Field 1 (User) is not empty
if (current.field1) {
// Get the user record
var userGr = new GlideRecord('sys_user');
if (userGr.get(current.field1)) {
// Set the company in Field 2
current.field2 = userGr.company;
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi