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

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

Recommended Posts

Posted

I am a newbie to FileMaker and use Pro 12 Adv with Windows Vista and Outlook 2007. I am creating my first DB and have an email function in it. I have tried with no success to create a script that will only send email if the email address field is populated. It seems that the script is not being looked at and the email will not work at all unless the "Button Setup" has been created.

 

I have tried all the suggestions in the forums and other sites with no success. What am I forgetting?

 

Thanks for all your help.

 

Dave

Posted

Dave,

 

Post the script and you will receive more help - 

 

 It seems that the script is not being looked at and the email will not work at all unless the "Button Setup" has been created.

 

Not sure what you mean by this  :idot:

 

Jim

Posted

Dave,

 

Post the script and you will receive more help - 

 

Not sure what you mean by this  :idot:

 

Jim

Here it is Jim. Thanks in advance for looking into this.

 

If [isEmpty ( Studios::Studio_eMail )]

   Omit Record

Else

   Send Mail [send via E-mail Client; To: Studios::Studio_eMail]

End If

 

Dave

Posted

You nearly had it -

 

From FMP Help:

 

IsEmpty
Purpose
Returns True(1) if field is empty, if a related field, related table, relationship, or file is missing, or if some other error occurs; otherwise, returns False(0).

 

So your script should look like this:

 

If [isEmpty ( Studios::Studio_eMail )] = 1
   Omit Record
Else
   Send Mail [send via E-mail Client; To: Studios::Studio_eMail]
End If

 

Is there more to your script?  This would only work for the current record. If you want to automate this script over multiple records add a loop.

 

Hope this helps!

Jim

Posted

You nearly had it -

 

From FMP Help:

 

IsEmpty
Purpose
Returns True(1) if field is empty, if a related field, related table, relationship, or file is missing, or if some other error occurs; otherwise, returns False(0).

 

So your script should look like this:

 

If [isEmpty ( Studios::Studio_eMail )] = 1

   Omit Record

Else

   Send Mail [send via E-mail Client; To: Studios::Studio_eMail]

End If

 

Is there more to your script?  This would only work for the current record. If you want to automate this script over multiple records add a loop.

 

Hope this helps!

Jim

Yes. I am only doing this for the active record (at this time).

 

Wow. Thanks.  I had used the "=1", but in all the wrong places!

 

BUT - I can't figure out how to get the  "= 1" AFTER the trailing "]". I can't access in-line statement editing.

 

Dave

Posted

 

If [isEmpty ( file::field )]

 

or Not IsEmpty( field )

 

 

maybe technically there some theory,  i am not that bright but....

 

I been using for years...thousands of time, my standard practice,  this format..

 

Have never need tested if  1   or 0

Posted

If [isEmpty ( file::field )]

 

or Not IsEmpty( field )

 

 

maybe technically there some theory,  i am not that bright but....

 

I been using for years...thousands of time, my standard practice,  this format..

 

Have never need tested if  1   or 0

Thank you Rod. I'll give this a shot and respond with my results.

 

Dave

Posted

Thank you Rod. I'll give this a shot and respond with my results.

 

Dave

 

Thank you Rod. I'll give this a shot and respond with my results.

 

Dave

 

I tried the IsEmpty route with no results.

 

I am launching the script from clicking an embedded picture. The trigger I am using is OnObjectEnter. Would this be correct?

 

Dave

Posted

I've attached a screenshot om my calc dialog box and in this format your script works for me (obviously you need to substitute Table::field).  And you OnObjectEnter trigger should work fine

 

Jim

post-88355-0-83421200-1367250845_thumb.j

Posted

I've attached a screenshot om my calc dialog box and in this format your script works for me (obviously you need to substitute Table::field).  And you OnObjectEnter trigger should work fine

 

Jim

 

...hmmmm... I am using the same script, but the script trigger is being ignored (or appears to be). Nothing I do in the script is actually being performed. Am I missing something at a more basic level?

 

Dave

Posted

Seems your script trigger is not firing - in layout mode be sure the field with the photo/trigger is brought to the front.  You could also set the field up as a Button to perform the script.

Posted

This is my script that doesn't get triggered (I suppose). Either with or without the "= 1" doesn't work.

The field for the actual email address is formatted as TEXT with no special options set.

The button I press to trigger the script is an image.

<sigh> such a learning curve.

Using the actual field as a trigger works the same as the script (or Button setup).

 

Dave

 

post-108866-0-72853900-1367258765_thumb.

Posted

The "=1" is completely unnecessary unless you are using GetAsBoolean.

 

New script. Still does not work however. I've been looking (somewhat feverishly) for a fix. This script only has to work on the current record.

 

Here's the current non-working script.

 

Thanks.  Dave

post-108866-0-04955700-1367271800_thumb.

Posted

Since you have Advanced, have you tried stepping through the script with Script Debugger and looking at error messages, and whether another script is being set by a script trigger?

Posted

Since you have Advanced, have you tried stepping through the script with Script Debugger and looking at error messages, and whether another script is being set by a script trigger?

 

Thank you Doug.

 

Yes I did.  I've been running it all day long - until just now I had no positive results.

 

I just ran the debugger with a "fresh pair of eyes" (I went and cut the grass and ate dinner) and lo and behold - the button was running the wrong script! I had written the one I showed in my previous email, but didn't connect it to the email button <sigh>.

 

Okay then. So I sleep well tonight. :hmm:

 

Thanks for the encouragement Doug, Rick, Jim and Rod.

 

For those who missed the answer I attached it again here for you.

 

Davepost-108866-0-41186400-1367295649_thumb.

This topic is 4225 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.