client script on load using asynchronous
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 07:57 AM
pls tell the error in the coding as on running the script
the email filed is undefined
if (g_form.isNewRecord()) {
g_form.setValue('u_caller', g_user.userID);
var caller = g_form.getReference('u_caller', getCallerDetails);
g_form.setValue('u_state', 'new');
function getCallDetails(caller) {
g_form.setValue('u_email', caller.email);
g_form.setValue('u_location', caller.location);
g_form.setValue('u_department', caller.department);
}
}
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 11:37 AM
Here is the updated script, and it will work for you.
if (g_form.isNewRecord()) {
g_form.setValue('u_caller', g_user.userID);
var caller = g_form.getReference('u_caller', getCallerDetails);
g_form.setValue('u_state', 'new');
function getCallerDetails(caller) {
g_form.setValue('u_email', caller.email);
g_form.setValue('u_location', caller.location);
g_form.setValue('u_department', caller.department);
}
}
In your code, on line number 3 you wrote name of callback function as getCallerDetails where as on line number 6 defined the function with name getCallDetails. Due to this the callback was failing.
Please mark the response helpful and accepted solution if it managed to address your issue.