Best practice to copy a Parent-child record to another Parent-Child tables

Hi everyone!

Trying to develop a sales App that user can create Quotes that can be converted to Sales Orders. User can create Sales Orders without a need of a Quote being created.

Thanks

0 3 81
3 REPLIES 3

Forget to mention that I already have a grouped action on the Quotes table that triggers first, a data action to copy  row from Quotes  table to Orders table, them a second one that set the [Status] inside Quote table to "Generated"  for Quotes that user had click the action. 

My question is: How to grab the related child records from Quote_Detail table and copy them to Orders_Detail table for generated quotes?

Welcome to the community!

You can do the following:

  1. In Quote_Detail table, add an action, lets name it: addOneOrderDetail, with the following settings:
    1. For a record of this table: Quote_Detail
    2. Do this: Data: add a new row to another table using values from this row
    3. Table to add to: Orders_Detail
    4. Set the column values accordingly, copying from the Quote_Detail table. Here the most important is to set the Ref column to the Orders table correctly. Your task will be easier if, when you copy the parent Quote record to an Order record, you copy as well the value of the Key  column, so that a Quote and an its associated Order both have the same key

  2. In the Quotes table, add an action, let's name it createOrderDetails, with the following settings:
    1. For a record of this table: Quotes
    2. Do this: execute an action on a set of rows
    3. Referenced Table: Quote_Detail
    4. Referenced Rows: [Related Quote_Details]
    5. Referenced ActionaddOneOrderDetail 
       
  3. Add createOrderDetails to your grouped action in the Quotes table. Make sure step 1.d. above is fulfilled. 

Thank you Joseph!

I try today  but still having problems. Will try tomorrow a couple more things and will post if I was able to implement your solution or still having problem. Anyway thanks so much for taking the time to review my post an offer a solution.

Top Labels in this Space