Jump to content

How can send Email birthday by automatically through filemaker server 18?


Msaeed

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

Recommended Posts

Hi All,

As per mentioned on topic I Would like ask someone to help me this issue because I am trying more than time unfortunately all is not successful to send e-mail for birthday in case have in the same day more than one employee.birthday.thumb.png.13ae26f9e6ccb1af9a05ed6e392824cf.png

 

on filemaker server :

 

1474416913_filemakerserver.thumb.png.cc895a46160a0a476c7ea4c0510a5b83.png

Link to comment
Share on other sites

This makes the assumption that the field "Birthday::C_Birthday" has a format of mm/dd/year:  

Allow User Abort [ Off ]
Set Error Capture [ On ]
Go to Layout [ Birthday List ]

    Set Variable [ $bdate_find; Value:
    Let ( [
    ~bday = Day ( Get (CurrentDate));
    ~bmonth = Month ( Get (CurrentDate))
    ];~bmonth&"/"&~bday&"/*" ) ]


Perform Find [ Specified Find Requests: Find Records; Criteria: Birthday::C_Birthday: “$bdate_find” ][ Restore ]


If [ Get (LastError)=401 ]
    Exit Script [ ]

Else

    Go to Record/Request/Page[ First ]
    Loop

        Send Mail [ Send via SMTP Server ][ No dialog ]
        Go to Record/Request/Page[ Next; Exit after last ]
    
    End Loop
End If
Exit Script

Edited by Jim Gill
  • Thanks 1
Link to comment
Share on other sites

Two side notes:

1. You can find people whose birthday is today, regardless of the date format in use, by:

Enter Find Mode [ ]
Set Field [ Employees::DateOfBirth; Substitute ( Get (CurrentDate) ; Year ( Get (CurrentDate) ) ; "*" ) ] 
Perform Find [ ]   

2. If you run such script on a daily basis, you will miss people whose birthday falls on a weekend or holiday. In addition, people born on February 29 will be skipped in 3 out of 4 years.

 

Edited by comment
  • Like 1
Link to comment
Share on other sites

If you intend to run this daily, then you need to make sure that if today is February 28 in a non-leap year, the search will find people born on February 28 as well as people born on February 29. That means setting the searched date field to something like:

Let ( 
today = Get (CurrentDate) 
;
If (
DayOfYear ( today ) = 59 and Month ( today + 1 ) = 3 ;
Substitute ( Date ( 11 ; 22 ; 3333 ) ; [ "11" ; "2" ] ; [ "22" ; "{28..29}" ] ; [ "3333" ; "*" ] ) ;
Substitute ( today ; Year ( today ) ; "*"  )
)
)

 

---
P.S. Do people still appreciate getting an automated birthday greeting?

  • Like 1
Link to comment
Share on other sites

4 minutes ago, Msaeed said:

Where I put this calculation ?

Here:

Enter Find Mode [ ]
Set Field [ Employees::DateOfBirth; «CALCULATION GOES HERE» ] 
Perform Find [ ]  

 

4 minutes ago, Msaeed said:

Actualy yesterday I try very thing working fine.

Not sure what you mean by that. Yesterday was not February 28 in a non-leap year.

 

Edited by comment
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

@Comment

On 10/10/2020 at 3:47 AM, comment said:

Enter Find Mode [ ]

Set Field [ Employees::DateOfBirth; Substitute ( Get (CurrentDate) ; Year ( Get (CurrentDate) ) ; "*" ) ]

Perform Find [ ]

I'm not a developer (just love FMP - ehh Claris) - curious why the three steps and not just the single step? So replace the quoted above with this:

Perform Find [ Specified Find Requests: Find Records; Criteria: Employees::DateOfBirth; Substitute ( Get (CurrentDate) ; Year ( Get (CurrentDate) ) ; "*" ) ][ Restore ]

Appreciate your insight!

Link to comment
Share on other sites

Because you cannot perform calculations in a find request.

You could - if you wanted - reduce this to two steps by using a variable. But the 3-step method has the advantage of showing exactly what's going on without requiring the reader to examine the find requests.

 

Edited by comment
Link to comment
Share on other sites

Got it!  Thank you for the enlightenment - totally makes sense now that you have said it.  You probably just saved me at least an hour of frustration in some future scripting endeavor!  Thanks again!!

Link to comment
Share on other sites

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