Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Autopopulate Contact field when the Account is selected.

Not applicable

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
   
}

 

11 REPLIES 11

Not applicable

Yes but the contact still not appearing to the field

did you mention field name correct

Not applicable

Yes

 

Not applicable

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

Not applicable

Hello @Community Alums 

I tried your script but wont work still not appearing the contact.