Jump to content
  • 0

trouble shoot triggered actions


Sam23
 Share

Question

I am a newbie trying to write my first triggered action.

I have watched several tutorials and my trigger code validates and saves, but there is no action in the tables. I am trying to insert a record into table 2 when a record is inserted into table1. Simple enough.

What are suggestions for trouble shooting the trigger? I have validated that the tables relationship is there, that I am using the inserted data (not the table name). My trigger looks identical to examples in this forum and on Caspio videos. 

Thanks for suggestions

Sam

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Here is the triggered action. When I insert a record into the Contact table, I want to insert a record into the Users table taking the ContactID (primary key of the Contact table) and putting that in the User1 table as a foreign key.

Screen Shot 2021-06-23 at 11.13.02 AM.png

Link to comment
Share on other sites

  • 0
6 minutes ago, Sam23 said:

Here is the triggered action. When I insert a record into the Contact table, I want to insert a record into the Users table taking the ContactID (primary key of the Contact table) and putting that in the User1 table as a foreign key.

Screen Shot 2021-06-23 at 11.13.02 AM.png

that seems to be correct, try removing the the relationships first if it will work, but that should work

Link to comment
Share on other sites

  • 0

Another thing to note - 

  • In the case of referential integrity enabled in a relationship, if a trigger executes on an insert event to the parent table, and inserts a record to the child table, the Triggered Action will fail. This is due to the action of inserting a record to the child table occurring first, thus failing the integrity check as the parent record does not yet exist.

https://howto.caspio.com/tables-and-views/triggered-actions/

Link to comment
Share on other sites

  • 0

In relation to the statement by @kpcollier, The newly inserted records during trigger run are temporarily stored on a proxy table represented by "#inserted", on this case, until the trigger ends, it is not considered as a content of the parent table yet.

On additional note, make sure that you have a backup of the tables involved or do your triggers first on test tables. Trigger actions directly affects the data you have on the tables and one wrong move can make a mess of them and you will have to pay for restoration.

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

×
×
  • Create New...