Business rule or Client script for updating a field value in a reference table

Nitin Baijal
Tera Expert

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?

11 REPLIES 11

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);

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.

MusabRasheed_0-1671649108005.png

 

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();
}
Please hit like and mark my response as correct if that helps
Regards,
Musab

So you are saying remove the business rule and just add this script?

Yes

Please hit like and mark my response as correct if that helps
Regards,
Musab

no Joy.

Not working.

Same error