Tuesday, 5 June 2012


Here’s a little demonstration on how to configure this scenario:

Just for some background, I’ve configured my backend SmO’s as follows:
·         - Product
·         - QuoteDetails
·         - QuoteItems 

[Associations]


I pre-populated my [Product] SmO with some values to be used on the “quote” form.

I then created an “Item View” on the [QuoteDetails] SmO, and an “Editable List View” on the [QuoteItems] SmO. Both were added to a single Page. Thus, when the [QuoteDetails Item View] executes its CREATE method, the [QuoteItems Editable List View] should also CREATE all items (products) that were added, using the newly generated ID value of the [QuoteDetails Item View] as the value for its ForeignKey.

For this purpose, I’ve set up the following Rule (please note that in order for this batch of actions to be executed correctly, the execution order needs to be set to “in a batch”):


In the DataMappings of the CREATE method of the [QuoteDetails Item View], navigate to the “Output mappings” tab, and map the return property [QuoteDetails_ID] to its SmO field counterpart on the MappingDestinations pane, as below:


Then for all the methods to be executed against the [QuoteItems Editable List View], edit their respective DataMappings and map the same field ([QuoteDetails_ID]) to the ForeignKey field available from the MappingDestinations, as indicated here: