Jump 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.

Featured Replies

I have a script set to run daily at midnight. It emails me only if there are tasks due in exactly 14 days. I have the script set to find unfinished tasks with today's date + 14. It works fine if there is something to be found.

Perform Find [Restore]

If [Get(FoundCount) ≠ 0]

Go to Record/Request/Page[First]

Loop

... do stuff ...

Go to Record/Request/Page[Next; Exit after Last]

End LoopElse

Show all Records

End if

When I run it as a normal user and the found set is empty, it asks me if I want to 'modify or continue'. I don't see a way to automate 'continue' when the script is running automated from the server. Am I missing something?

Yes. Set Error Capture On.

You don't need the Else Show All Records, either.

Make sure your script starts in the proper layout. There should be a Go To Layout before the Find.

  • Author

Yes. Set Error Capture On.

You don't need the Else Show All Records, either.

Make sure your script starts in the proper layout. There should be a Go To Layout before the Find.

Thanks! You got me going in the right direction.

Definitely helps to specify the layout first.

And thanks for confirming that 'else show all records' was unnecessary. I suspected it wasn't.

The finished script:

Go to Layout ["Task List" (Tasks)]

Set Error Capture [On]

Perform Find [Restore]

If [Get(LastError) = 0]

Go to Record/Request/Page[First]

Loop

... do stuff ...

Go to Record/Request/Page[Next; Exit after Last]

End LoopEnd if

Set Error Capture [Off]

That looks good. You don't need to Set Error Capture Off. Server scripts behave as if the user logs in, performs the script and logs out. So, nothing persists after the script runs. Also, any script that you run on File Open will run with each server script. That could be a good thing as forgetting to set necessary globals is often forgotten.

Just a point on style, I never use Perform Find (Restore). I can't read the script after and see what my Find criteria are. Rather, I structure all Finds this way:

Set Error Capture On

Go to Layout "MyFindLayout"

Enter Find Mode

Set Field (field; criteria)

Perform Find

If (Get (FoundCount >0))

do stuff

Else

do this

End If

  • Author

That looks good. You don't need to Set Error Capture Off. Server scripts behave as if the user logs in, performs the script and logs out. So, nothing persists after the script runs. Also, any script that you run on File Open will run with each server script. That could be a good thing as forgetting to set necessary globals is often forgotten.

Just a point on style, I never use Perform Find (Restore). I can't read the script after and see what my Find criteria are. ...

Thanks for the hint about Set Error Capture Off. I have often used the find-mode/set-field method, but have recently found that sometimes I like being able to specify using restore. It can be quite precise. These two dialog boxes make it pretty easy:

specify_found_item_dialog_box_1.png

In the first dialog box above, I get to add as many consecutive finds as I like, including, as you can see, an omit.

specify_found_item_dialog_box_2.png

The second dialog box allows me to specify exactly what this part of the find should do, including variables I've set earlier in my script! That can be awfully convenient.

Yes, true. But when you read the script, unless you "open" the Perform Find (restore) script step, you cannot see the criteria. It's really a matter of style.

  • Author

Yes, true. But when you read the script, unless you "open" the Perform Find (restore) script step, you cannot see the criteria. It's really a matter of style.

Ah - so you like being able to see directly from within your script step dialog exactly what's being found. You're right -- it is a style preference thing. Thanks for clarifying.

  • Author

Okay here's something weird...

When I run this script as the user 'cron' - a limited user - from my computer it works.

When I run this script as user cron from the server set to run at 12:08 AM, it doesn't.

Script Debugger shows Error 101, (Record is missing) but the one found record is plainly visible when it runs and an email is sent.

I can only guess that it stops for some misunderstood reason when run by the server.

I'm confused because it works for me as the limited user, but not when the server automatically calls the limited user to do the same.

< mumbling many swear-words under breath... >

Okay here's something weird...

When I run this script as the user 'cron' - a limited user - from my computer it works.

When I run this script as user cron from the server set to run at 12:08 AM, it doesn't.

Script Debugger shows Error 101, (Record is missing) but the one found record is plainly visible when it runs and an email is sent.

I can only guess that it stops for some misunderstood reason when run by the server.

I'm confused because it works for me as the limited user, but not when the server automatically calls the limited user to do the same.

< mumbling many swear-words under breath... >

Script debugger always reports a 101 after running off the end of a found set in a loop.

Create an account or sign in to comment

Important Information

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

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.