Using a custom event action to trigger a Filemaker script

Support for our integrated Contact Manager, Calendar, and Project Tracker.
Posts: 9
Joined: Tue Dec 18, 2018 4:45 pm
PostPosted: Wed Feb 06, 2019 4:34 pm
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.
Posts: 9
Joined: Tue Dec 18, 2018 4:45 pm
PostPosted: Wed Feb 06, 2019 4:39 pm
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.
Posts: 9
Joined: Tue Dec 18, 2018 4:45 pm
PostPosted: Wed Feb 06, 2019 4:51 pm
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.
SeedCode Staff
SeedCode Staff
Posts: 259
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Wed Feb 06, 2019 4:57 pm
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
Posts: 9
Joined: Tue Dec 18, 2018 4:45 pm
PostPosted: Wed Feb 06, 2019 6:13 pm
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.
SeedCode Staff
SeedCode Staff
Posts: 259
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Thu Feb 07, 2019 9:44 am
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
Posts: 9
Joined: Tue Dec 18, 2018 4:45 pm
PostPosted: Thu Feb 07, 2019 3:36 pm
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?
SeedCode Staff
SeedCode Staff
Posts: 259
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Thu Feb 07, 2019 4:49 pm
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
Posts: 9
Joined: Tue Dec 18, 2018 4:45 pm
PostPosted: Thu Feb 07, 2019 6:23 pm
Excellent! Thanks.

Return to SeedCode Calendar

Who is online

Users browsing this forum: No registered users and 1 guest

cron
(855) SEEDCODE
support@seedcode.com
Follow us: