Create Children On Save

I have a request from a potential customer that wants the following functionality and I want to know if it is possible.

They want to from an ORDER automatically Create Child Records based on the value in a field in the parent ORDER. The ORDER will contain the number of Items that must be manufactured and they want BATCH Child records to be created when the ORDER is saved.

Example:
ORDER is for 36 Pairs of gloves. 36 pairs will be manufactured in 3 x BATCHES of 12 each. They want these BATCH Records to be created when the Parent ORDER is Saved or at a minumum clicking on an Action that โ€œCreate Batchesโ€

Is this possible?

0 27 1,602
27 REPLIES 27

Soon, supposedly we have a feature coming our way this week.

Man that will be great @Grant_Stead. I will Beta test this for sure if required

@Grant_Stead, maybe I am interpreting that thread where @praveen made that comment incorrectly, but it seems this will only allow the creation of a record in the background in the same table and not necessarily in a Child Table. I hope I am wrong and that it will be possible to do the creation of that record in the Child Table!
Also wonder if it would be a loop function to create multiple Child Records as per my requirement??
Lets wait and see

@Henry_Scott you will be able to create records in another table, not just in the same table. For your scenario, you will have a composite action that composes three actions, each of which adds one batch record.

Youโ€™ve got us all excited over here!

Yes!!! Cannot wait @praveen

Will we be able to create mutliple child records simply by creating or updating a parent record?

Simon@1minManager.com

@1minManager It sounds like you could make use of WorkFlows to accomplish what youโ€™re asking. Paired with a webhook using Appsheet API.

@praveen, any ETA for this functionality? @Grant_Stead, @MultiTech_Visions, @1minManager

If youโ€™re not needing to be able to modify these child records right away inside the app, you could make use of the API system. This would create your batch records in the background, the only downside here is that you have to wait for the sync of the order record for the child records to be created - because itโ€™s during the sync that the API call and everything happens.

Just thought I would throw that out there as another possible solution.

@MultiTech_Visions, no need to modify them right away after creation and can wait for the sync.
So I can just follow the help in this link to achieve that?
https://help.appsheet.com/en/articles/1980012-adding-records-to-a-table

@Henry_Scott yes, that and the other articles about enabling the API etc. will get you where you need to be.

@MultiTech_Visions, will need a Start and End in the JSON to achieve multiple Child Record creation. Challenge - the number of records is based on the Value in a Field in the Parent record. So not sure how to incorporate that because that is the โ€œcounterโ€ for the loop

This might be something worth looking into.

https://www.w3schools.com/js/js_json_arrays.asp

If you have some experience in Java itโ€™s relatively similar it seems like.

It gets tricky fast when youโ€™re doing things like this, and really easy to fall into an infinite loop.

You need something to hold the number of batch records that need to be created [Ordered_Batch_Records], one that holds the batch records related to the order (best accomplished via a ref connection I think) [Related Batch_Records], then another to do the intelligence of checking for Batch records that have yet to be created [Pending_Batch_Records].

Then in your JSON workflow template, for the SELECT() inside the <<Start: youโ€™ll want to include a condition that checks to see if the record being created is already inside the [Related Batch_Records].

It getโ€™s tricky fast, or maybe Iโ€™m making it too complicated.

@MultiTech_Visions, that is what I was afraid off as I am not a developer to the core and code with trial and error approach.
Maybe I should just wait for the release @praveen was referring to. Hopefully by the end of this week

Itโ€™s live. You can try it. Look for the action: โ€˜Data: add a new row to another table using values from this rowโ€™
Will add documentation, etc in the next day or two. It has only been minimally tested, so let us know about bugs you run into.
Will also add a new top level post in the community.

@praveen Great news!
Will try it

Great!!!

@praveen I tried it out, and my app just wonโ€™t save. Iโ€™m effectivtely duplicating about 9 columns of a record from my PM table into my RO table. It never shows the progress bar, so nothing saves. What could be causing this?

Hi Kolbi, Not sure I understand. When you say โ€œmy app wonโ€™t saveโ€, Iโ€™m guessing no change actually was made and therefore there is no change to sync.

Easiest way to help may be if you send the app details to support@appsheet.com. Thanks

What happens if the data in the parent table changes, could the copied row change as well?

Not inherently. You would have to add functionality to your app to accomplish this, such as virtual column or an action.

So the action works. Do you have any suggestions on how I can make it create multiple records based on a column number in my parent?

@School_Bus Were you able to figure it out? I am looking for a similar need where I need to generate children records based based on a calculated list.

Well this is what I did

Top Labels in this Space