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 11:32 PM
Syntax is 100% correct, please refer below script which is written in Run script activity. I guess current_owner Variable is affecting this, please change name to something else and remove current from there, keep name as old_owner. It should work.
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 11:39 AM
I have been at it and changed my script to -
var user_ref = current.variable.owner.getValue(); //get the sys_id of the existing owner
var userManValue = current.variables.newowner.getValue(); //get the sys_id of the new owner
var userManDisplayValue = current.variables.newowner.getDisplayValue(); //get the displayValue of the new owner
var userU = new GlideRecord('u_shared_mailbox');
if (userU.get(user_ref)){ //get owner record using the callers sys_id
userU.setValue("owner",userManValue,userManDisplayValue); //set the owner's value and displayValue (prevents roundtrip to server)
userU.update(); //update record
current.variables.owner = current.variables.newowner;
gs.addInfoMessage("Owner has been updated to " + userManDisplayValue);
}
PS - i am getting same error, can it be because of some weird permissions. I am admin