Need a script to display email id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 09:24 AM
Hi
I have the client script below it is getting displayed as sysid .
I need email id to get displayed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 10:01 AM
Hi @Saib1 ,
As you are trying to use "newValue" which is not reference value of changed item ( i.e. selected user ).
newValue is giving the sys_id of selected record and its adding in UserId column as it is.
You need to use the actual field name and get the reference object and use dot walking for email.
Try with below code, replace the "requestor" with correct variable and same for setValue() variable.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
// alert("newValue->"+newValue); // returning sys_id of selected record without reference
var reqRef= g_form.getReference('requestor', setUserEmail); // get the record object
//using the callback method set the UserId
function setUserEmail(reqRef){
g_form.setValue("userid", reqRef.email);
}
}
Let us know if works for you or not.
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 06:15 AM
Since the variable i am using is List Collector , Hope this will not work the getReference