Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Business Rule to populate the Field values From Another Field Through Reference Field

sekhar6
Tera Contributor

Hai,

Need a help in creating business rule. I am new to service now .kindly help on this script.

I Have an Customer Field On the form ,I have taken Reference table in Customer Field, If I Select The Customer Field, Display the Customer Name field and Multiplier Field  

image

 I Was Trying This Script ,Using Business Rule.

var gt = new GlideRecord('u_ln_customers');
gt.addQuery('u_ln_customers', current.u_customer);
gt.query();

 

if('u_customerISNOTEMPTY');
{}

 

if(gt.next()){}

 

current.u_ln_customers_u_customer_name =gt.u_customer.u_cname;

 

current.u_ln_customers_u_multiplier = gt.u_customer.u_multiplier;

image

 image

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

try this since u_customer is already reference then no need to query

Directly dot walk and fetch the values

current.u_ln_customers_u_customer_name = current.u_customer.u_cname;
current.u_ln_customers_u_multiplier = current.u_customer.u_multiplier;

Regards
Ankur

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

Hai 

Ankur Bawiskar,
Its Not Work ,Please help me on this,
Thank you.
 
 
 

Hi,

please share some more details

1) u_customer field is referring to which table

2) which table is having u_customer field? is it Special event?

Regards
Ankur

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

Hai,

we have Taken reference tables as"  u_ln_customers  "

update as this

current.u_customer_name = current.u_customer.u_cname;
current.u_multiplier = current.u_customer.u_multiplier;

Regards
Ankur

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