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:51 PM
Yes but the contact still not appearing to the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:58 PM
did you mention field name correct
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 11:52 PM
Yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 11:41 PM
Hi @Community Alums ,
Check you have selected onChange in the type field
Use the below script to debug
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
// This will show the field value on top of form
g_form.addInfoMessage('Account: " + g_form.getValue('account'));
// Check field name is correct
var selectedAccount = g_form.getValue('account');
// Check the value is correct
if (selectedAccount == 'Microsoft' ){
g_form.setValue('contact', 'Microsoft Service Desk');
}
}
Thanks
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 11:51 PM
Hello @Community Alums
I tried your script but wont work still not appearing the contact.