Previous Topic

Book Contents

Book Index

Next Topic

Propagating Changes

There are two methods that allow you to propagate changes made to a business object or one of its attributes to other opened dialogues. The two differ primarily in the scope of their reach.

To propagate changes globally to all other dialogues regardless the transaction, call

Application.propagateChange(BO, TypeOfChange)

This method globally propagates a change made to a BO. It enables all windows to respond to this event, which might represent a wide range of operations from mere adding of a newly created BO to an existing view to a complete refresh of all windows, which is the strongest operation. Unlike Application.updateEditorsFor, which propagates the changes only within one transaction (e.g. within all BOEditors) that doesn’t need to be committed beforehand, Application.propagateChange sends a notice about this event and updates all dialogues globally regardless the transaction and in addition, requires that the changes are already committed to the database.

If the user has changed an object, for example, in the BOEditor following the commit of the transaction and then calls propagateChange without recommitting the transaction, a dialogue pops up notifying the user about a change that was made to the object from outside and consequently, the BOEditor is switched to a read-only mode.

To propagate changes only to open BOEditors within the scope of one transaction, call

Application.updateEditorsFor(BO,Attribute,ApiTransaction)

Notifies all open BOEditor dialogues about a change of an attribute. Attribute is the attribute whose change you want to propagate and that might consequently be reloaded by other dialogues, ApiTransaction is the transaction the BO is being edited in and within which the change will be propagated.

Example - Updating an opened BOEditor window

We assume that you have run Valuemation and logged in correctly before starting this code. oVM variable now holds Application object. See Login Syntax for the section of the opening code.

'updates an opened BOEditor window when the "oPerson" BO is changed –

‘the person moves to another department.

'creates a transaction

Set oTrans = oVM.createTransaction()

'gets a person by its ID number - only one object is in the output 'collection

'since the personID is unique identifier

Set oPerson = oVM.getBOTypes.find("Person").createFilter(oTrans,"personid='P-10001'").item(0)

'gets and changes the BOField

Set oBOF = oPerson.getBOFields.find("departmentId")

oBOF.setValue("D-10002")

'updates the opened editor

oVM.updateEditorsFor(oPerson, oBOF, oTrans)

See Also

Working in Transactions

Creating Transactions

Registering Objects to Transactions

Working with Objects in Transactions

Getting Transactions

Committing Transactions

Undoing Changes and Aborting Transactions

Calling Workflows on Certain Events