Create a Copy of a Business Object
One way of creating a new Business Object is to create a copy of an existing object.
The ScriptUtil utility method, as shown below, is provided for doing this:
cust1 = com_example_scriptingguide_Factory.createCustomer(); cust2 = ScriptUtil.copy(cust1); cust3 = cust1; |
The script in the example above, sets the cust2 process data field to refer to a copy of the Business Object that the cust1 process data field refers to, and cust3 to refer to the same Business Object that the cust1 process data field refers to.
The ScriptUtil.copy() method performs a "deep" copy, which means that it copies all the objects contained by the Business Object being copied, as well as the Business Object itself. It is only for copying whole Business Objects, not for just copying BOM Primitive values.
Copyright © Cloud Software Group, Inc. All rights reserved.