Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2648 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I am running the following script on my FileMaker Server:

It works 99% of the time, but every once in a while, it will not work (due to server overload or the plugin getting disabled)

What I would like to do is to catch when an error occurs and send note to me that something went wrong. I tried adding the following two scripts steps (separately, not at the same time) after running the Set Variable and they did not do anything. 

1. If [$result = "ERROR"]

2. If [get(LastErrorMessage)]

These were the steps suggested on the 360Works website. Is there another idea that may work?

 

 

Posted

Hi jzhess88,

I would first recommend that you do not chain all of your function calls with "and" inside the one set variable script step. It is better practice to have them called in separate set variable calls. The way you have it now if one function in the chain fails, the entire script step will fail. Once you break them out into their own set variable calls, you will be able to trap for errors for each function call and be able to tell where the error is coming from. The first option is the correct way to trap for errors in this instance. The second option would be for if you were calling the functions as script steps (only available in FM16). I would write the script as follows:

Set Variable [$result; Value: EmailRegister( "LicenseString"; "Registered To" )]
if[$result="ERROR"]
//however you want to handle error.
End If

Set Variable [$connect; Value: EmailConnectSMTP( "Hostname" ; "Emailaddress" ; "password" )]
if[$connect="ERROR"]
//however you want to handle error.
End If

Set Variable [$create; Value: EmailCreate( $EventEmail; $ToEmail; $EmailSubject )]
if[$create="ERROR"]
//however you want to handle error.
End If

Set Variable [$body; Value:EmailSetBody( $EmailBody; "html" )]
if[$body="ERROR"]
//however you want to handle error.
End If

Set Variable [$cc; Value: EmailCCRecipients( $CCEmail )] 
if[$cc="ERROR"]
//however you want to handle error.
End If

Set Variable [$bcc; Value: EmailBCCRecipients( $BCCEmail )]
if[$bcc="ERROR"]
//however you want to handle error.
End If

Set Variable [$send; Value: EmailSend]
if[$send="ERROR"]
//however you want to handle error.
End If

Set Variable [$disconnect; Value: EmailDisconnect]

Also, looks like your email password has been redacted while I was writing this response but it is probably a good idea to change your password.

  • Newbies
Posted

Thank you ryan360Works, I did what you said and separated each step out and had the if statements exactly as you have them. Inside the if statements, I simply added the send mail script step to send a plain text email to myself.

I then disabled the 360works plugin on my server and ran the script to see if it would catch any errors. Unfortunately, it did not. 

Do you have any other suggestions of what I can do?

Posted

Disabling the plugin will not result in "ERROR" but rather a "?". A better test would be to put non-sense/incorrect credentials in the EmailConnect function call or just bad data into any of your parameters for any function call that would result in an error. 

This topic is 2648 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.