Scripting
There are some changes to scripting in version 5.x, for example, process data fields are now wrapped in a data object and factory methods have changed. Some differences are automatically fixed for you when you import your projects for the first time. Depending on the complexity and nature of your scripts, you may need to fix some scripts manually by addressing the problems markers raised on those scripts.
var custName = customerInstance.name;and you could set the value of the Name business object property as follows:
customerInstance.name = "Clint Hill";In version 5.x, process relevant data are now wrapped in a data object. To set the same value of the Name process parameter or data field property, you must now do the following:
data.customerInstance.name = "Clint Hill";
com_example_ordermodel_Factory.createOrder()
factory.com_example_ordermodel.createOrder()
Important note: You can assign the values of two BOM attributes to the same BOM class instance object. In this situation, changes are made by reference, and the changes are reflected in both places. However, once the script is complete, the data are saved and that single value is stored and, thereafter, behaves as two independent objects. This differs from the behavior in pre-version 5.x, where a business object instance can only be contained by a single container at any given instant.
Working with Enumerated Types (ENUM)
If you want to categorize objects as different types, instead of using a number or a free format string, you can use an Enumerated Type (ENUM). In pre-version 5.x, you could use unqualified names to define ENUMs in scripts. In version 5.x, this is no longer supported. You must use a fully qualified name (qualified by the package name) for the enumerations in the script. The qualified name of enumerations to be used in scripts is similar to the factory names, with the qualified name formatted to replace dot '.' by '_' an underscore character.
com_example_shared_ColorEnum.REDbecomes
pkg.com_example_shared_ColorEnum.RED
Case Data Access Methods
Prior to TIBCO BPM Enterprise version 5.x, specific JavaScript classes were dynamically generated to handle specific BOM case classes. TIBCO BPM Enterprise version 5.x has been changed to provide a statically defined (that is, it is always there) JavaScript class that is used for all case classes, where the case class is identified in the method parameters using its fully qualified name (that is, "<bom_package_id>.<case_class_name>".
Upon migration from pre-version 5.0, scripts are automatically changed to use the equivalent new method, assuming there is an equivalent method, and that the referenced Business Data projects have been imported.
ScriptUtility
ScriptUtil provided methods to create various types of object, to modify Duration objects, and to serialize business objects into or deserialize them from their XML representation in pre-version 5.x. These are no longer provided. ScriptUtility should now only be use for copying objects. See ScriptUtil for more information.
Regular Expression Patterns for Text Fields No Longer Supported
In pre-version 5.x, when defining a Primitive Type, text fields could be constrained to match certain patterns. Regular expression patterns are no longer supported.
List Objects No Longer Supported
In pre-version 5.x a process data field specified as an array could refer to multiple instances of a business object. Similarly, a BOM class attribute could refer to multiple instances of a business object. Multiple instances of business objects used to be handled using a List object. List objects are no longer supported. In version 5.x, you must use JavaScript Arrays instead.
WorkManagerFactory and Process Classes
var theOfferSet = WorkManagerFactory.getWorkItem().getWorkItemOffers();becomes
var theOfferSet = bpm.workManager.getWorkItem().getWorkItemOffers();Example 2
var myActivityLoopIndex = Process.getActivityLoopIndex();becomes
var myActivityLoopIndex = bpm.process.getActivityLoopIndex();