Open topic with navigation

TIBCO Business Studio™ - BPM Edition 5.4.0

# Working with Single Instance Attributes of Business Objects

To add contact details to a Customer instance, you can write a script.

    	if (data.cust != null)
    	{
        		data.cust.phone      = phoneNumber;
        		data.cust.email      = emailAddress;
        		data.cust.address    = postalAddress;
    	}

Ensure that no variables used to assign attributes are `null`. Otherwise, the script causes a runtime exception that can cause the process to fail when the script is run.

If the address attribute of the Customer class is an attribute of an Address type rather than a Text type, the address attribute needs to be set to refer to an instance of the Address class before the attributes of the `customer.address` can be set. For example, the following can be done:

    if (data.cust != null)
    {
        data.cust.phone      = phoneNumber;
        data.cust.email      = emailAddress;
        if (data.cust.address == null)
        {
            data.cust.address = factory.com_example_data.createAddress();
         }
        data.cust.address.street   = streetAddress;
        data.cust.address.district = districtAddress;
        data.cust.address.city     = cityAddress;
        data.cust.address.country  = countryAddress;
        data.cust.address.postcode = postCode;
    }

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.