Business Rule - Query another table, set value of current reference field 'dot walk'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2017 07:08 AM
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();
}
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2017 04:41 AM
Hi Josh,
Did it work for you, let us also know.
Regards,
Shariq