Page 1 of 1

Default values on new event

PostPosted: Mon Jun 29, 2020 8:47 am
by Jim2001
When I create a new event I've noticed that the "resource" field auto-enters the second resource on my list. I've looked at the "Create Edit Delete Event" script but can't seem to set the resource field to blank or any other value when a new event is triggered.

Re: Default values on new event

PostPosted: Mon Jun 29, 2020 9:18 am
by kcembrey
Hi Jim,

This functionality is built-in to the core calendar and happens before you save the event.

The calendar will automatically set the resource value to the "none" resource (if that's still in your resource list) and there are no resource filters applied. If you've applied a resource filter, then the resource will be set to the first resource in the list of selected resources. This order is based on the order of the resources in your filter list, from top to bottom.

If you wanted to change this behavior and define a resource to auto-assign based on your own criteria, you could do that as part of an "On Create" event action.

I hope that helps!

KC

Re: Default values on new event

PostPosted: Mon Jun 29, 2020 10:01 am
by Jim2001
Thanks. Does the "On Event Create" happen immediately or does it wait for an actual new record to be created and then perform the Action? I created a script that does a SetField[] for resources but when triggered the field is not related to events and just tosses an error.

I have a "None" entry in resources and no filtering yet the second resource continues to appear.

Re: Default values on new event

PostPosted: Mon Jun 29, 2020 10:43 am
by kcembrey
Hi Jim,

The FileMaker record for an event is not created until a user clicks the save button in the popover. So an "On Event Create" action can really only be used to set the DayBack editEvent Object using JavaScript. You can set the editEvent.resource object to an array of the resource values you'd like to be auto-populated in the popover when creating an event on the calendar.

If you'd like to do this with a FileMaker script instead, you could use your own FileMaker layout to modify events instead of using the DayBack popover.

If you'd like us to dive in and help you develop this customization, you can pick up an implementation package at this link and we'll get our first screen-share scheduled: http://sites.fastspring.com/seedcode/pr ... onpackages

Regards,

KC

Re: Default values on new event

PostPosted: Mon Jun 29, 2020 11:02 am
by Jim2001
Sorry I neglected to say that I am using a customized event edit layout (FM window).

Re: Default values on new event

PostPosted: Mon Jun 29, 2020 11:46 am
by kcembrey
Hi Jim,

If you're using your own layout, then the "Submit Event From WebViewer" script is called as soon as an event is created on the calendar. You can check the title to see if it is "New Event" to know that a new event was created, and if so, modify the resource value just before the "Create Edit Delete Event" is performed.

You could also change the value in the "Create Edit Delete Event" script, which is where the event is actually created and the field values set.

Regards,

KC