AutoFill field

Shir Sharvit
Tera Contributor

Hi,

In the incident form,
if the "service" field is empty, should be filled in automatically when the "service offer" field is filled. If the "service" field is full - do not update it.
The value to be filled in the "service" field is the value in the "service offer" parent field (which is a reference to the record).
The record that is filled has a field called "parent" - this is the value that will enter the "service" field.

 

Thank,Shir

9 REPLIES 9

pooja_m
Mega Guru

Hi Shir,

 

Are you referring to "Service offering" field in incident form if you say "service offer"?

 

pooja_m_0-1700040101144.png

 

yes

Hi Shir,

 

Below is the code:

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
  var seroff = g_form.getReference('service_offering').parent;
   var bs = g_form.getValue('business_service');
  if(bs == ''){
    g_form.setValue('business_service',seroff);
  }  
}
 
Hope it solves your solution.
 

kristof_szakal
Tera Contributor

Hi,

you should create a Business Rule on the incident table.

> The condition should check if the "service" field is empty and the "service_offer" field is not empty.

> In the script query the parent record to get the needed field.

> Update the service field from the other field.

Let me know if it worked!