Default status for new event.

Notes on our latest calendar for FileMaker 13,: DayBack
Posts: 3
Joined: Tue Sep 29, 2015 8:49 pm
PostPosted: Sun Feb 10, 2019 11:39 pm
Is it possible to set default status for new event, I know I cannot do auto calculate field on status of sample events as that will not be reflected when they do new event via the web viewer. Is there anyway I can do it?
SeedCode Staff
SeedCode Staff
Posts: 357
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Mon Feb 11, 2019 9:03 am
Hi metrogeekythinker,

If you're running DayBack 10.42 or later, you can take advantage of the new Event Actions in DayBack for FileMaker: https://www.seedcode.com/pmwiki/index.p ... entActions

With an On Event Create event action, you could set the "editEvent.status" value to whichever default status that you'd like and the popover will be pre-populated with that value. More details on the objects available in JavaScript button and event actions can be found here: https://www.seedcode.com/pmwiki/index.p ... ionObjects

And if you'd like help with this custom action, 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

I hope that helps! Let us know if you have any further questions.

Regards,

KC
Posts: 3
Joined: Tue Sep 29, 2015 8:49 pm
PostPosted: Wed Feb 13, 2019 6:31 am
My version is 10.31, so there is no workaround for that version? I managed to do it under the Submit Event From WebViewer script but it only happened after it saved and closed.
SeedCode Staff
SeedCode Staff
Posts: 357
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Wed Feb 13, 2019 9:12 am
Hi metrogeekythinker,

That's correct. Before we introduced Event Actions in DayBack for FileMaker, you could still accomplish the same as an "On Save" action with the FileMaker scripts.

The other option, if you decide you'd rather not update your DayBack, would be to use your own event layout so that you can control what happens when the event layout is opened, saved, or deleted in FileMaker scripts.

Regards,

KC
Posts: 60
Joined: Wed Jun 23, 2010 9:21 pm
PostPosted: Sat Apr 18, 2020 7:20 am
I'm pretty sure I got the syntax wrong in Line 7 of the attached example. I looked all over the documentation and couldn't find it. Suggestions?
Attachments
Event Action example.png
Event Action example.png (172.6 KiB) Viewed 26741 times
SeedCode Staff
SeedCode Staff
Posts: 357
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Mon Apr 20, 2020 6:51 am
Hi Eugene,

If you're looking to set the Status field to the literal value of "scheduled" when creating events, then your action should look like this:

"javascript:editEvent.status = 'scheduled';"

Using the square brackets like '[[schedule]]' is used for referring to another FileMaker field's value in a custom action. In an On Event Create action, the record hasn't been created yet, so the value of any fields referenced would be empty.

You can read more about event actions and see examples in our docs here: https://www.seedcode.com/pmwiki/index.p ... entActions

And learn more about JavaScript here: https://www.w3schools.com/js/

Regards,

KC
Posts: 60
Joined: Wed Jun 23, 2010 9:21 pm
PostPosted: Tue May 12, 2020 3:15 am
KC,

Thanks for the correction. I finally had a chance to try it out, but it didn't work. The status field remains empty when a new event is created. Thoughts?

Eugene
SeedCode Staff
SeedCode Staff
Posts: 357
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Tue May 12, 2020 7:14 am
Hi Eugene,

I'm able to get this working in a stock copy of DayBack, so here are a couple of things to check.

1. Make sure you've added this as an "On Event Create" action under the "$$sc_EventActions[$sc_SourceNumber]" variable in the "Load Source Settings at Startup..." script. The $$sc_CustomActions variable is for custom button actions which are triggered by the user pressing a button.

2. Make sure you've added this event action to the correct source. There is a section in the script for each source, so just verify you've added the action to the source you're creating events for in the calendar.


Here's the exact code that I've put in the beginning of my $$sc_EventActions variable. You should be able to copy and paste this into your $$sc_EventActions variable for the action to take effect.

// BEGIN Event Action 1
Substitute ( List (

"On Event Create" ; // Action trigger, what interacting triggers this action
"javascript:editEvent.status = 'scheduled';" ; // FM Script Name or Javascript
"NA" ; // Prevent default action. Will prevent the default behavior
"NA" // Event types that can use this action in brackets [editable, readonly] (optional)

) ; [ ¶ ; $sc_FieldSeparator ] ; ["NA" ; ""] )
// END Action


;

Return to DayBack Calendar for FileMaker

Who is online

Users browsing this forum: No registered users and 2 guests

(855) SEEDCODE
[email protected]
Follow us: