Bot to generate parent and child record in the same time

Hi, 

I try to do something with bots but I do not find the correct mecanism.

 I have an "order" table and an "order_line" table. I can add order lines from the order form.  When saving the order, I would like to create a row in my "stock_entry" table. I also want to create several rows in my "stock_entry_line" table, for each order lines.  These stock entry lines being child of the stock entry row previously created.

Process step by step :

- Create order (open order form)

- add order lines (from order form directly using the "Is part of" mecanism)

When saving order form :

- create stock_entry

- create stock_entry_lines, for each order_lines. Each stock_entry_line being related to the stock_entry previuosly created.

 

I know how to use bots to create stock_entry from the order and stock_entry_lines form the order_lines separately. I don't understand how to combine these 2 processes.

Chris

0 4 236
4 REPLIES 4

Hi, 

 

I used this solution before in another use case. And do not see hpw this could help here. The difference is that my need involve 4 tables (order, order_line + stock_entry, stock_entry_line) not only 2. I edited my post.

 

Thanks

 

Hi Christophe. You can create as many actions as needed to cover 2, 4 or more tables.

For example, your Order Form Saved action would trigger creating a new Stock Entry row. Then a Bot will trigger on the creation of this new Stock Entry row to create several Stock Entry Line rows.

I have the same question as the original poster, and I don't think the actual question was ever really answered.  Within a bot, how do you create both a new parent record and a related child record?  The id that gets generated for the parent record will need to be referenced to create the child record.  

The answers to date seem to be focused on how to create multiple records but they don't really address the issue of how to reference the new parent when creating the child records.

Top Labels in this Space