- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 01:41 AM
Hi All,
OncellEdit client script is not working, please tell me the issue in the below code
I have to use g_form.getReference call back function to populate user email
u_name is reference filed refering to USER table
u_email is string filed, onCellEdit of Name(refernce) filed I have to populate user's email in the email string filed
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
alert("test on cell edit");
if (newValue != oldValues) {
var userEmail = g_form.getReference('u_name', populateEmail);
alert(userEmail.email);
saveAndClose = true;
} else {
saveAndClose = false;
}
function populateEmail(userEmail) {
g_form.setValue('u_email', userEmail.email);
}
callback(saveAndClose);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 02:56 AM
Hi,
what type of BR is this? if this is before update then remove current.update()
Also do you want it to set when u_name changes or you want to set u_email always
if always then use this
current.u_email= current.u_name.email;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 02:56 AM
Hi,
what type of BR is this? if this is before update then remove current.update()
Also do you want it to set when u_name changes or you want to set u_email always
if always then use this
current.u_email= current.u_name.email;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 03:36 AM
This is before business rule I am using this table as embedded list to other table
Whenever I have updated the parent update record this embelist list table should update
whenever u_name chnages automatically email should populate in the list view, is this possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 04:45 AM
Hi,
embedded list will get refreshed only when you save the record; it won't show immediately
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 05:26 AM
Hi Bawiskar,
can you please tell me the best practice,
Below code is befor BR but I am using current.update(), is there any other way to achieve this
if (current.u_name.changes()){
current.u_email= current.u_name.email;
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2020 05:44 AM
Hi,
Can you share screenshot?
you are trying to update field in embedded list or parent form?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader