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?

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

1 Like

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

1 Like

@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! :slight_smile:
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.

5 Likes

You’ve got us all excited over here!

1 Like

Yes!!! Cannot wait @praveen

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.

1 Like

@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. :slight_smile:

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

Simon@1minManager.com

@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.

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

1 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

1 Like

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

1 Like

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.

5 Likes

@praveen Great news!
Will try it