Autopopulate Contact field when the Account is selected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:28 PM - edited 12-13-2023 11:55 PM
My code wont work or i missing something? please need help.
Contact is reference field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var selectedAccount = g_form.getValue('account');
if (selectedAccount == 'Microsoft' ){
g_form.setValue('contact', 'Microsoft Service Desk');
}
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:40 PM - edited 12-13-2023 10:42 PM
Hi @Community Alums ,
Your script looks good. Can u try putting an alert before if condition to ceck wht u getting in selected account variable?
alert(selectedAccount);
I believe u might be getting either empty value or some different value rather then Microsoft.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:48 PM
Nothing appeared
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 11:20 PM
Hi @Community Alums ,
After reading the comments what I can think is that the account field might be available on some other table. Can u right click on the label n check that field (click on show field later n see from which table the field is coming)
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:46 PM
Hi
Did you select right onchange fieldname correct which it will work