onchange client script to auto populate email id field when particular caller is selected

Ramya Madhu
Tera Contributor

How to write  an onchange client script to auto populate email id field when particular caller is selected

2 REPLIES 2

Chandu Telu
Tera Guru
Tera Guru

Hi 

Check the below link it will help you

https://community.servicenow.com/community?id=community_question&sys_id=54e5949ddbcee7c05d782183ca961914

 

Thanks

Chandu Telu

Mark the answer if correct/helpful , if it helps

Musab Rasheed
Tera Sage
Tera Sage

Hi Ramya,

What method you tried till now as you will get hundreds of similar thread.? If you need no code solution and this is on Catalog item then follow below approach

https://community.servicenow.com/community?id=community_article&sys_id=49deac8ddb92a010ab0202d5ca961967

If it is on Incident form as it looks from 'Caller' field then follow below approach

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading) {
      return;
   }


   var usr = g_form.getReference('caller_id', callBack);
	
}

function callBack(usr)
{

	g_form.setValue('email', usr.email);


}
Please hit like and mark my response as correct if that helps
Regards,
Musab