This isn’t as much a problem as it is a procedural thing.
I have a form to be filled out. When complete, the submit button should send an email and write the form data to a table.
Currently I have the code placed in Events, in the OnBeforeInsert. The reason for this was when I did the email OnAfterInsert, any quotes/apostrophes the user entered into the notes field, would end up with “/” characters in the email body. I found if I did it OnBeforeInsert, the text was sent clean, just like it was typed in. All has been working fine, until last night…
An email was received from a new submission, but the data was not in the table… So clearly something happened in the split second between the script sending the email (successfully) and writing to the table (unsuccessfully)…and I’m not sure of the best way to figure out what happened, so that I can fix it.
This morning I built a test version of the same form…with OnAfterInsert, and instead of grabbing the {fields} and putting them in the email immediately, I instead grab the ID for the new record {ID}, make it a global variable [tmpID]={ID}, and then run a query to pull in the fields of that [tmpID] into the email from the table…which works fine too, and actually doesn’t break the formatting of apostrophes e.t.c.
What is the “best” way to do this? The test version works well, but if it’s failing to write to the table, then we’re still going to have an issue. Is there specific code I can add into the form to notify the user if the table write fails? I am using Version 8.00.0043.
Thanks very much in advance.