Open topic with navigation

TIBCO Business Studio™ - BPM Edition 5.4.0

# 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:

    data.cust1 = factory.com_example_data.createCustomer();
    data.cust2 = bpm.scriptUtil.copy(cust1);
    data.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 `bpm.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.

To copy an array of business objects, use `bpm.scriptUtil.copyAll(array)`

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO Business Studio™ - BPM Edition

Copyright © 2015-2023. Cloud Software Group, Inc. All Rights Reserved.