March 7, 201312 yr I have set up a database that allows employees to log in and out of tasks throughout the day so that we can track productivity and use the data to better bill. One of the features of the database is an "In Progress" button that allows department managers to, with a single click, see what employees are actively working on. It all works well except for end of day tasks. Every couple of days, an employee will leave without first logging out of their task. So the next morning, the supervisor will have to manually adjust their time. In an ideal world, each department manager would check the "In Progress" task before heading home to catch them right away, but we don't live in an ideal world. What I want to do is, at a specific time each day, send just these select few managers a quick notification that says "there are five open tasks in your department" (and if there are no open tasks in their department that day, they wouldn't need to receive anything). But because of the volume of users, I want the script to run on the client side rather than server side. I think the actual script is pretty straightforward: If [ Get (AccountName ) = "Manager" ] Go to Layout [ "Layout Name" ] Enter Find Mode Set Field [ Task End Time; "==" ] Perform Find If [ Get (FoundCount) = 0 ] Go to Layout [ "Home" ] Halt Script Exit Script Else Beep Show Custom Dialog [ "Message"; "You have two open tasks in your department." ] Exit Sccript End If End If (I do realize that setting it up this way would cause whatever the person is actively doing to be interrupted by this script. I haven't quite thought of a resolution to that just yet.) But how would I set such a script to run on the client side at, say, 4:00 PM Monday thru Friday? Is there a plugin available or can it be done with the tools and script steps FM has built in?
March 8, 201312 yr Are you open to reconsidering the idea of sending the department managers an email via server-side script? The resulting script would not be very different. You'll already want to add to your script an additional find condition so that managers are only notified about open tasks in their own departments. The next step is to wrap that in a loop that uses a different department for the find and a different manager's email address to send notifications to for each pass through the loop. I don't think this will have any more significant a performance impact on your users than the same steps running on each manager's instance of Pro. If anything, I'd expect performance to improve since your users' work never gets interrupted by this script, and they aren't pulling task data down the network. Also, managers would receive the notifications even when they don't have the FileMaker solution open. On another note, why do you have the Halt Script -> Exit Script sequence? The Exit Script step in that sequence will never run. As a general best practice, I never use the Halt Script step. Any script could wind up as a sub-script of some other script, and we can't always foresee how that parent script might work; having a Halt Script step in the sub-script can easily muck-up processes that ought not be mucked up. Just the Exit Script step by itself should suffice.
March 8, 201312 yr Author Yeah, an e-mail would work just as well. Oddly enough, I've had experiences where the opposite was true regarding the Halt Script step. I've seen scripts that end with just Exit Script not work at all and leave users in the middle of scripts when they shouldn't be, which ends up causing a problem when they go on to run another script somewhere else. (Granted, these issues were in scripts I'd inherited from a previous developer, so I'm sure the problem could have been something else and I just never discovered it.) At any rate, I've never seen the Halt Script step cause any problems firsthand, but I can see how it could.
Create an account or sign in to comment