Business Rule - Query another table, set value of current reference field 'dot walk'

Josh80
Tera Expert

Hi

Doesn't seem like this would be too hard but can't seem to quite get it.

I created a record producer that creates a new user and creates a new record in a custom 'user account relationship' table.     Works great, etc..

However, upon insert of the new 'user account relationship' record which has only 2 reference fields (u_user and u_customer_account), I want a business rule to fire and backfill the 'company' field on the User record, as the same 'company' that is in the table of the 'u_customer_account' company field.


Can I dotwalk such as 'current.u_customer_account.u_master_company_name' below?

It is not working.

var gr = new GlideRecord('sys_user');

  gr.addQuery('sys_id',current.u_user);

  gr.query();

  gs.log("User value: " + current.getValue('u_user'));

  while(gr.next()){

  gr.company = u_customer_account.u_master_company_name;

  gr.update();

  }

5 REPLIES 5

Hi Josh,



Did it work for you, let us also know.



Regards,


Shariq