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 10:47 AM
Evaluator: com.glide.script.RhinoEcmaError: Cannot read property "request_item" 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.request_item.variables.current_owner);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 10:58 AM
Do one thing, in Workflow create another 'Run script' which will parallel run with Catalog task like below and in Run script you can add your code, it should work perfectly and no need to do additional validation as well.
Code:
var ee = new GlideRecord('tablename');
ee.addQuery('owner' , current.variables.old_owner);
ee.query();
if(ee.next())
{
ee.owner = current.variables.new_owner;
ee.update();
}
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 11:25 AM
So you are saying remove the business rule and just add this script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 11:43 AM
Yes
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 12:53 PM
no Joy.
Not working.
Same error