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

Samaksh Wani
Giga Sage
Giga Sage

Hello @akin9 

 

What is not working in this Client Script, Does it is not setting the value.

 

 

Hi @Samaksh Wani ,

Thank for the quick reply!

Its not clearing / updating the values

Hello @akin9 

 

You need to check the fields on which you are doing operation, It might have some other client script and Business rule working on it.

 

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

 

Regards,

Samaksh

 

 

Hi @Samaksh Wani ,

i have changed the table "alm_hardware" its updating the values. but clear is not working.

can you help me for clearing the values.