Open topic with navigation

TIBCO Business Studio™ - BPM Edition 5.4.0

# Create an Instance of a Class

You can create a new Business Object directly.

Taking the example of the Person/Customer/Employee BOM:

In order to create a customer instance, we first need a data field to hold the instance. This is done by creating a new Data Field in a process, and setting the Type to be an External Reference to a type in the BOM. Here we have created a field called `cust` that can hold instances of the Customer class instances:

Then a Script Task can be dragged onto the process diagram from the Tasks palette:

View the Script Task properties and from Script Defined As menu, select JavaScript:

The Describe Task Script dialog box is displayed. Type the script.

It is very important to understand that when a process starts, the `cust` process data field does not contain or refer to an instance of the Customer class, it just has the ability to. So, the first thing to do before attempting to access the attributes of the process data field is create an instance of the Customer object and assign it to the `cust` process data field. The instances of the Customer class are created by the "Customer Factory Method", the name of the factory that creates Customer instances is based on the name of the BOM package that contains the Customer class as described in the previous section.

    data.cust = factory.com_example_data.createCustomer();

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.