Posting multiple child transactions

You may sometimes need many child transactions to be posted for every source transaction. This can be done by posting a child transaction for every row in a source grid using GenMap.

Consider the example of Employees to Contacts. The Employee form has  a grid in which different addresses and phone numbers are entered.  For each of these rows a child transaction into contact is posted as shown below.

 

Employee Form (Source TStruct)

Name           

Date of join   

EMail            

Phone number Address
8999000 #1, Bangalore
7890000 #2, Bangalore
6788999 #3, Bangalore

Contacts form (Target TStruct)

Contact Name

Contact type  

Phone           

Address         

Contacts form (Target TStruct)

Contact Name   

Contact type     

Phone              

Address            

 

Contacts form (Target TStruct)

Contact Name   

Contact type     

Phone              

Address            

 

In the above example, note that for every row in the grid a transaction is posted into contacts. You can use a control field to post only certain rows as transactions.

Set Based On DC property as DC2. That is for every row in dc2, a child transaction is posted.

Map the fields as below

 

Source Target field Target row
Name ContactName 1
Phone MobilePhone 1
Address Address 1
EMail EMail 1
“Employee” ContactType 1

In case a business rule fails in any of the child transactions, all transactions are rolled back including the source transaction. This will ensure the data integrity is maintained. Moreover, a genmap gets executed when ever data is submitted to a TStruct. It may be through a front end form, a web page, an import from CSV or XL file or an action.

When the source transaction is deleted, all child transactions are removed. Similarly, when a any row in the source grid is removed, the corresponding child transactions are removed.