I need to write a script include to fetch data for one field in table A from another table .

kaushal_snow
Mega Sage

The condition is, I need to auto populate some fields in table A from table B. Shall I have to write a script include or it can be done using business rule also. Please help me with the following.

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
1 REPLY 1

yaswanthi2
Giga Sage

Hi @kaushal_snow 

You can write an after business rule to run on update.

The BR should be created in the first table.

Check below sample code:

 (function executeRule(current, previous /*null when async*/) { 
        
  var gr = new GlideRecord('second_table');
             
   current.field_name = gr.field_name;
        
   gr.update();
        
            
  }(current, previous);