Jump to content
  • 1

Nested Triggered Actions and Parent/Child Relationships


Casey

Question

I have 1 form that, upon creation of a new record, needs to create records in several tables.  I'll give a simplified example:

New CallLog Record creates:

New Client record

New Pet record

New Visit record

 

The problem is that the Pet is a child of the Client and the Visit is a child of the Pet and the Client (using autonumber primary key in the parent and integer foreign key in the child).  The CallLog record is a parent to all three for lookup purposes.

I created a triggered action with 3 insert blocks to create these three entries.   However, it looks like the triggered action must be asynchronous because sometimes the child is able to grab the primary key from the parent and other times it is blank (indicating the parent hasn't been created yet).  I don't know what the ID for the parent will be until after it is created. 

The obvious solution is to create the first parent record then trigger the child to be created from there (as a triggered action on, say, the Client table rather than the CallLog table).  However, Caspio doesn't allow nesting of triggered actions so an error is produced.

My current solution is a terrible and very fragile cascade of datapages that is autocompleted and autosubmitted and redirected to the next one as my user sits with infinite patience and tries not to hit the browser's back button.  I can hardly stand it and I built it.  I'm 100% sure my users will not tolerate.

I've racked my brain for a way to solve this problem.  Any ideas?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello Casey,

If I understand you correctly, you just wanted to be able to populate 3 (or 4) tables at one Form Submission, with the help of Triggered Actions. In my opinion, it would be difficult to implement even on other Database systems.

My suggestion would be to create one DataPage per table that needs to be populated. Then structure the flow of your app linearly going to the next DataPage after submit. It could look something like: Client > Pet > Visit.

Do note that you can:

1.) Send/Receive Parameters on each Form Load/Submit (https://howto.caspio.com/parameters/passing-parameters/)

2.) Users may start at any point of the sequence, given that you can provide the right parameter to receive for the Foreign Key. (You can do a Virtual Field form submission for pre-existing records. Like how they setup this tech-tip)

 

Hope this helps in some way.

Regards,

DN31337

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...