I have a Incident form if i select Caller field in Incident form then all the Fields like mobile number, location, name, Email Should be auto populate

kranthi2
Tera Expert

Hi,

I have a Incident form if i select Caller field in Incident form then all the Fields like mobile number, location, name, Email Should be auto populate.

Can any one help me out for the same.

Awaiting for your response,

Regards,

Sreenadh.

 

 

6 REPLIES 6

Priyanka Chandr
Mega Guru

Hi Kranthi,

For that purpose we need to use script include and Then you can write an On Load Catalog Client Script 

go through this link 

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

 

Kindly mark it correct and helpful.

Thanks and regards,

Priyanka

Onkar Pandav
Tera Guru

Hi,

You can try dot walking in the form layout option.

One example of department is shown below. Refer below screen shot.

find_real_file.png

 

Or other option is to write onChange() client script. Refer below code.

 

function onChange(control, oldValue, newValue, isLoading)
{

if (newValue == '')
{
g_form.setValue('caller_id', '');
}

var callr = g_form.getReference('caller_id', setManager);

function setManager(callr)
{

if (callr)
{
g_form.setValue('manager', callr.manager);
g_form.setValue('email', callr.email);
//same for other fields

}
}
}

 

Let me know if it is useful.

Hi,

 

Client Script details:

Type: onChange

Table: Incident

Field Name: Caller

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

    if (isLoading || newValue == '') {

          return;

    }

 

 

    var caller = g_form.getReference('caller_id');

g_form.setValue('department',caller.department);

g_form.setValue('location',caller.location);

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

g_form.setValue('name',caller.name);

g_form.setValue('Mobile phone',caller.mobile_phone);

 

 

}

 

Kindly mark the answer Correct and Helpful if this answers your question.

Thanks,

Ali.

Anil Shewale
Mega Guru

hi kranti

see the following screenshots it might help you.

find_real_file.png

find_real_file.png

If it help mark helpful or correct  

Thanks and regards

Anil