auto populate one field based on other 3 fields

akin9
Tera Contributor

Hello Exports,

We want to auto populate based on assigned to field on asset table.

cost center ,department and location.

Requirment

1.If assigned to is empty  "cost center ,department and location" fields should be empty.

2.If not should populate values  based on the assigned to .

I have tried below onchange client script but not working pls correct me.

Table =" alm_asset"

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
if (newValue == '') {
g_form.clearValue('department');
g_form.clearValue('cost_center');
g_form.clearValue('location');

return;
}
var ven = g_form.getReference('assigned_to', _AssetData);

function _AssetData(ven) {
g_form.setValue('department', ven.department);
g_form.setValue('cost_center', ven.cost_center);
g_form.setValue('location', ven.location);
}
 
}

 

 

10 REPLIES 10

Hello @akin9 

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh