Client Script to auto populate field based on another field not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 05:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 05:42 AM
Hi @User393503 ,
Try this code and make sure the backend value of the fields are correct.
var budget1 = g_form.getDisplayValue('parent');
g_form.project = budget1;
Regards,
Dhanraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 05:47 AM
Hi @User393503
Please try with the script below.
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('caller_id', doAlert); // doAlert is our callback function
}
function doAlert(caller) { //reference is passed into callback as first arguments
g_form.setValue('email',caller.email);
g_form.setValue('phone',caller.mobile_phone);
g_form.setValue('phone',caller.location);
}
Please change the variable name
Thanks
dgarad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 05:51 AM
@User393503 Please update the client script as follows.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var budget1 = g_form.getReference('budget', callback);
function callback(budget1){
g_form.setValue('project', budget1.parent);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 05:55 AM
This script returns the sys_id. I want the display value to show.