Page 1 of 1

Using a custom event action to trigger a Filemaker script

PostPosted: Wed Feb 06, 2019 4:34 pm
by chrisGilbert
Hi,

I want to use a custom event action to trigger a Filemaker script. I know I can do this using the FMP protocol but I need to be able to get the value for the field BEFORE it gets changed as well as its CURRENT value. How can I do this? Even if I use the "Before Event Save" action the record seems to get updated before I can get its previous value.

Re: Using a custom event action to trigger a Filemaker scrip

PostPosted: Wed Feb 06, 2019 4:39 pm
by chrisGilbert
It's alright - I figured it out. Set "Prevent default action" to yes, send the new value through a parameter and sort it out in the Filemaker script.

Re: Using a custom event action to trigger a Filemaker scrip

PostPosted: Wed Feb 06, 2019 4:51 pm
by chrisGilbert
Not quite worked out. The problem now is that I don't know what fields have changed - so I would have to send over all the fields in the script parameters and then compare them in the script. Is there any other way???? - this could potentially have problems where fields like a long description will not go in the URL parameter nicely.

Re: Using a custom event action to trigger a Filemaker scrip

PostPosted: Wed Feb 06, 2019 4:57 pm
by kcembrey
Hi Chris,

This is probably something that would be best accomplished using a JavaScript event action, rather than initiating a FileMaker script on the "Before Event Save" action.

Are you adding these actions to DayBack for FileMaker, or DayBack Online (in WebDirect)?

Thanks,

KC

Re: Using a custom event action to trigger a Filemaker scrip

PostPosted: Wed Feb 06, 2019 6:13 pm
by chrisGilbert
Hi KC,

I would've used the Javascript option but I need to create an email for the user to see and send. I tried using the mailto protocol but was stymied by it not working on iPhones and iPads. I can get it to work using the Filemaker script steps so that's what I need to use. I'm using Dayback Online in a web viewer (as you know from my other queries!).

Chris.

Re: Using a custom event action to trigger a Filemaker scrip

PostPosted: Thu Feb 07, 2019 9:44 am
by kcembrey
Thanks for the details, Chris.

This is a little tougher. The custom action in DayBack Online just waits until the open url step has completed in the browser, which is very quick. It's likely that this URL doesn't have a chance to tell FileMaker to perform the script before DayBack is able to save the changes through the PHP Relay file.

I think the best option is to do the comparing of the event and editEvent objects directly in the JavaScript event action in DayBack Online, then if your fields have changed, you can then call an FMP URL which sends out the email with the details through FileMaker.

And if you think you'd need help with making these changes, we offer implementation packages so we can do some screen-sharing with you, or have you send over the files so we can finish the implementation for you. Packages can be used for consulting, coaching, or modifications like these and start at blocks of 3 hrs for $190/hr. When the time comes, you can use this link and, with a day or two notice, we can schedule some time to work with you:

http://sites.fastspring.com/seedcode/pr ... onpackages

Re: Using a custom event action to trigger a Filemaker scrip

PostPosted: Thu Feb 07, 2019 3:36 pm
by chrisGilbert
Thanks! I'll try that out - should have thought of it before.

Supplementary question - is there any way in Javascript to find who is currently logged into Dayback?

Re: Using a custom event action to trigger a Filemaker scrip

PostPosted: Thu Feb 07, 2019 4:49 pm
by kcembrey
Sure, Chris.

You can get the DayBack Online user's account name from the calendar config with this:

seedcodeCalendar.get('config').accountName

Hope that helps!

KC

Re: Using a custom event action to trigger a Filemaker scrip

PostPosted: Thu Feb 07, 2019 6:23 pm
by chrisGilbert
Excellent! Thanks.