Business rule or Client script for updating a field value in a reference table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 07:31 AM
Hi Experts,
I have a requirement. I have a catalog item to perform the task below -
Update the "Owner" field in a reference table with a new Owner.
example , if user1 is the owner of a mailbox, we can use this form to update its owner to user2.
I am able to gather all the information on the catalog item - mailbox name, current owner, new owner and then create a task through workflow steps to change current owner to new owner
The last part of this requirement is -
"Create a business rule so that after the task is created, the new user is automatically made the owner of the mailbox, then close the task."
I believe an after business rule will work best for it where I just update the owner field with the new value.
Can anyone please help me with configuration and scripting part of it?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 07:48 AM
Hello,
Yes Business rule looks better option here since you want to update once task is created then task should be closed so you can write sample After Business rule on SC_TASK table but add condition should as short description so that BR should run only for this SCTASK, code can be like below
var ee = new GlideRecord('tablename');
ee.addQuery('owner' , current.variables.old_owner);
ee.query();
if(ee.next())
{
ee.owner = current.variables.new_owner;
}
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 08:59 AM
I tried following what you said but i think i am missing something.
I did not find Short description but i did find subject title in filters.
how do i check if the business rule actually even ran? i checked system Diagnostics>Debug business rule but i dont see anything there 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 10:22 AM
I am getting this error when this script is run -
Evaluator: com.glide.script.RhinoEcmaError: Cannot read property "variables" from null script : Line(5) column(0) 2: 3: // Add your code here 4: var ee = new GlideRecord('u_inigo_shared_mailbox'); ==> 5: ee.addQuery('owner',current.variables.current_owner); 6: ee.query(); 7: if(ee.next()) 8: {
I think it is just a small thing that we are missing, i am unable to put my finger on it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 10:37 AM
Try below ?
current.request_item.variables.current_owner
Regards,
Musab