I have code in my querysave event that sends an email using @MailSend based on a field’s status. This works fine but in cases where an error occurs in another field on the form during an attempted save (field validation formula) the email is being sent in spite of the field error then again when the error is corrected an the form is saved. How can I prevent the querysave event from sending the email if all field validations have not been successfully met?
Subject: RE: Error Trapping before querysave event
Thanks for the quick response.
My original reason for doing it in the querysave event was because part of the code that triggers the email is based on whether the document is newly created (@If(@IsNewDoc; @MailSend…). If I put this same code in the postsave it wouldnt send the email for newly created docs unless I create a workaround. Now that you’ve made a great suggestion, I guess I could simply create a hidden field that populates based on whether the doc is new or not and then test against that field in the postsave event.