Populate field value from a dot walked field on another table.

Michael Nash
Giga Expert

HI Guys, 

I need to Populate field value from a dot walked field on another table.

I'm trying to create a client script on the task table.

I need to stamp in the u_managing_agent value on all tasks and that information comes from the company field that is referencing the customer_account table and the value needs to be from the account_parent field in that table.

 

This is what I have so far, 

 

onChange script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var mAgent = g_form.getValue('company');
if (mAgent == '');
g_form.setValue('u_managing_agent' , 'customer_account.account_parent');
}

5 REPLIES 5

Musab Rasheed
Tera Sage
Tera Sage

Hi,

You cannot do dot walk like this, Either use GlideRecord or getreference or GlideAjax. Best is to use GlideAjax and you will find any many sample code for your reference. Mark my answer as correct if that helps

Regards

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

Thanks, Musab,

 

I'm new to scripting so could you assist me with that?

AnirudhKumar
Mega Sage
Mega Sage

You cannot dot-walk in client script.

You will have to use a GlideAjax and call a script include for this.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

why not show the dot walked field on form layout itself?

regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader