Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Email script - checking for a date

Featured Replies

  • Newbies

Hi all,

I need a smidge of advice.

I am hoping to add a script to my client database.

Here is what I would like to happen.

I open fm, the script runs. The script performs a find looking for all records in the 'reviewdate' field that either = todays date or are anywhere between todays date and seven days into the future. When it has located these records I want the script to copy the data in the 'review notes' field into an email for each record found.

I have so far worked out how to do the find and how to paste the data found into an email for each record. However the trouble I am having is getting it to only select dates within that 7 day period and if the dates don't fall in that seven day period I don’t want it to do anything. I guess it would also be a good function for it to ignore any records that have previously been emailed.

As you can probably tell FM is new to me. I am doing ok but this seems intricate.

Regards,

Drew

You want to do a range search

So just use:

Freeze Window

Allow user abort[Off]

Set Error Capture[On]

Set Field[ yourdatefield ; Get(CurrentDate) & "..." & Get(CurrentDate) + 7 ]

Perform Find[]

If[ Get(LastError) <> 0 ;

..Show Custom Dialog[ No Records Found ; No Records Found ; Ok, Cancel ]

#Do Whatever you want here

Exit Script[]

End If

#Rest of your script here

Now keep in mind, that some of the functions may not be called the same thing in FM 5 (can't help you there) but the concept should be the same.

  • Author
  • Newbies

Thanks, I am an 8.5 user now. Need to update my profile. Will test this today and let you know how it goes.

Drew

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.