Custom Button Actions
DayBackForFileMaker.CustomActions History
Hide minor edits - Show changes to markup
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
https://archive.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
Custom actions let you add your own buttons to the calendar. These buttons run your own FileMaker scripts and are a great way to extend the calendar's capabilities.
Button actions let you add your own buttons to the calendar. These buttons run your own FileMaker scripts and are a great way to extend the calendar's capabilities.
Overview: What Are Custom Actions?
(:title Custom Button Actions:)
Overview: What Are Button Actions?
This can be accomplished by adding a few lines to your CSS file as described in our CSS documentation here.
This can be accomplished by adding a few lines to your CSS file as described in our CSS documentation here.
Event Actions: run scripts without a button
You can also call scipts based on user actions like clicking on an event or hovering over an event. More here: Event Actions
You'll define your action buttons by editing the script "Load Source Settings at Startup...". For each source in that script you'll see a variable called "$sc_CustomActions". The definition of that variable declares the names of your action buttons and the names of the scripts they should run.
This takes the form "Button Name<comma> Script Name". Here is the $sc_CustomEventActions definition for the popover shown above:
You'll define your action buttons by editing the script "Load Source Settings at Startup...". For each source in that script you'll see a variable called "$$sc_CustomActions". The definition of that variable declares the names of your action buttons and the names of the scripts they should run.
This takes the form "Button Name<comma> Script Name". Here is the $$sc_CustomActions definition for the popover shown above:
You'll define your action buttons by editing the script "Load Source Settings at Startup...". For each source in that script you'll see a variable called "$sc_CustomEventActions". The definition of that variable declares the names of your action buttons and the names of the scripts they should run.
You'll define your action buttons by editing the script "Load Source Settings at Startup...". For each source in that script you'll see a variable called "$sc_CustomActions". The definition of that variable declares the names of your action buttons and the names of the scripts they should run.
Can I remove the custom actions cog/button from the popover?
This can be accomplished by adding a few lines to your CSS file as described in our CSS documentation here.
. SomeClassName .btn:hover { \\
.SomeClassName .btn:hover { \\
. SomeClassName .btn:active { \\
.SomeClassName .btn:active { \\
. SomeClassName .btn::before { \\
.SomeClassName .btn::before { \\
Add Icons and Colors to your Custom Action Buttons
You can change the appearance of your Custom Actions buttons by adding CSS specific to those buttons. The way this works is by tagging your button with a new class, and then adding CSS for that class. Here're how:
"View Event Record, Go To Event Record From WebViewer, SomeClassName";
"Sample Custom Action, Custom Action Example, AnotherClassName" ;
""
)
background-color: blue;
}
. SomeClassName .btn:hover {
background-color: gray;
}
. SomeClassName .btn:active {
background-color: black;
}
. SomeClassName .btn::before {
content: "\f00c";
font-family: FontAwesome;
padding-right: 5px;
}
JavaScript Custom Actions
Introduction
While the actions described above all run scripts in your FileMaker file, you can also run custom javascript action to interact with other web services. This is new to DayBack for FileMaker as of version 9.53.
We previewed this at DevCon 2015 and showed off a couple examples of what you may want to use JavaScript actions for. Though this video shows them in DayBack Online, they're now available to DayBack for FileMaker also:
(:youtube w2MSlerRrSc width=500:)
Adding JavaScript actions to your file.
coming soon
Using Event Data Tokens
DayBack gives you the ability to specify data tokens that will be replaced by event data at the time the JavaScript action is run. This means your JS actions can pass along fields from your event and that'ss is useful for passing event data to other services (like including an event's title in your Slack post). Using this token works a bit differently that the $vars you can use in your FileMaker scripts.
In your JavaScript custom actions, the data tokens are wrapped in double brackets with the mapped field identifier [[DataToken]]. This identifier is not the field name, it's a generic version of the field name DayBack uses under the hood. For example if you wanted to reference your event ID field it would look like this [[eventID]] even though your field name be named "myevents::primarykey".
An example URL using data tokens might look like: https://www.somewebsite.com?id=[[eventID]]&date=[[DateStart]]
Here is a list of all the tokens you have access to:
contactID
contactName
description
end (the end timestamp of the event)
eventID
eventSource (the number of the event's source: "1" not "Source No 1"
projectID
ProjectName
resource
start (the starting timestamp of the event)
status
titleEdit (the event summary)
title (your eventsummerycalc field)
If you are using data tokens in Javascript code we recommend wrapping the token in quotes so if the value is empty it doesn't throw an error in your javascript code. All data tokens are strings this way which makes coding more consistent.
An example here might be: var eID = [[eventID]]; alert(eID);
Even with boolean values like allDay the preferred method here is to use a string for example: var isAllDay = "[[allDay]]" === "true"; //Evaluates to a boolean
(:include DayBackOnline.CustomActionExamples:)
Need to run scrips in web apps instead of FileMaker Scripts?
While the actions described above all run scripts in your FileMaker file, you can also run custom javascript actions--this is new to DayBack for FileMaker as of version 9.53.
While the actions described above all run scripts in your FileMaker file, you can also run custom javascript action to interact with other web services. This is new to DayBack for FileMaker as of version 9.53.
title (the event summary)\\
titleEdit (the event summary)
title (your eventsummerycalc field)
eventID
eventSource (the number of the event's source: "1" not "Source No 1"
projectID
ProjectName
resource
start (the starting timestamp of the event)
status
title (the event summary)\\
contactID
contactName
description
end (the end timestamp of the event) \\
DayBack gives you the ability to specify data tokens that will be replaced by event data at the time the custom action is run. This is useful for passing event data to other services for example.
All data tokens are wrapped in double brackets with the mapped field name [[DataToken]]. For example if you wanted to reference the ID field as it is mapped by default it would look like this [[id]]. Data tokens use the names that you assigned when you mapped your fields in the source settings (your field names). The only exception here is we also utilize a token called "allDay". This is a boolean that signifies an all day event or not.
DayBack gives you the ability to specify data tokens that will be replaced by event data at the time the JavaScript action is run. This means your JS actions can pass along fields from your event and that'ss is useful for passing event data to other services (like including an event's title in your Slack post). Using this token works a bit differently that the $vars you can use in your FileMaker scripts.
In your JavaScript custom actions, the data tokens are wrapped in double brackets with the mapped field identifier [[DataToken]]. This identifier is not the field name, it's a generic version of the field name DayBack uses under the hood. For example if you wanted to reference your event ID field it would look like this [[eventID]] even though your field name be named "myevents::primarykey".
https://www.somewebsite.com?id=[[id]]&date=[[DateStart]]
https://www.somewebsite.com?id=[[eventID]]&date=[[DateStart]]
Here is a list of all the tokens you have access to:
var eventID = [[id]]; alert(eventID);
var eID = [[eventID]]; alert(eID);
Using Event Data Tokens
DayBack gives you the ability to specify data tokens that will be replaced by event data at the time the custom action is run. This is useful for passing event data to other services for example.
All data tokens are wrapped in double brackets with the mapped field name [[DataToken]]. For example if you wanted to reference the ID field as it is mapped by default it would look like this [[id]]. Data tokens use the names that you assigned when you mapped your fields in the source settings (your field names). The only exception here is we also utilize a token called "allDay". This is a boolean that signifies an all day event or not.
An example URL using data tokens might look like: https://www.somewebsite.com?id=[[id]]&date=[[DateStart]]
If you are using data tokens in Javascript code we recommend wrapping the token in quotes so if the value is empty it doesn't throw an error in your javascript code. All data tokens are strings this way which makes coding more consistent.
An example here might be: var eventID = [[id]]; alert(eventID);
Even with boolean values like allDay the preferred method here is to use a string for example: var isAllDay = "[[allDay]]" === "true"; //Evaluates to a boolean
JavaScript Custom Actions
Introduction
While the actions described above all run scripts in your FileMaker file, you can also run custom javascript actions--this is new to DayBack for FileMaker as of version 9.53.
We previewed this at DevCon 2015 and showed off a couple examples of what you may want to use JavaScript actions for. Though this video shows them in DayBack Online, they're now available to DayBack for FileMaker also:
(:youtube w2MSlerRrSc width=500:)
Adding JavaScript actions to your file.
coming soon
Here's an overview of how the work along with some tips for extending our example actions and making your own:
(:youtube N8TtttLL5AY width=500:)
This means that DayBack will draw an action button named "View Event Record" and when it's clicked it will call the FileMaker script named "Go To Event Record From WebViewer".
This means that DayBack will draw an action button named "View Event Record" and when it's clicked it will call the FileMaker script named "Go To Event Record From WebViewer". The third item intentionally left blank is a "Watch For Event Changes" option. This can be set to True or False. In most cases this is unnecessary and will complicate your scripts so we recommend to leave the third parameter blank. An explanation of this feature is lower in this article.
>> What does "watch event for changes do" as an action parameter.
Watch For Event Changes
Each source gets its own action buttons, and our sample events table comes with two: one to jump to the event's record in it's own FileMaker layout, and another to just show a simple dialog.
Each source gets its own action buttons, and our sample events table comes with two: one to jump to the event's record in its own FileMaker layout, and another to just show a simple dialog.
Each source gets it's own action buttons, and our sample events table comes with two: one to jump to the event's record in it's own FileMaker layout, and another to just show a simple dialog.
Each source gets its own action buttons, and our sample events table comes with two: one to jump to the event's record in it's own FileMaker layout, and another to just show a simple dialog.
Take a look at our example script "Go To Event Record From WebViewer". That shows you the variables you'll have access to and how to determine the source number from the source name in $source.
Take a look at our example script "Go To Event Record From WebViewer". That shows you the variables you'll have access to.
Note that you can change the text at the top of the drawer ("Call your own scripts") to anything you'd like by adjusting the calendar's translation file.
This takes the form "Button Name<comma> Script Name". Here is the $sc_CustomEventActions for the popover shown above:
This takes the form "Button Name<comma> Script Name". Here is the $sc_CustomEventActions definition for the popover shown above:
This takes the form "Button Name, Script Name". Here is the $sc_CustomEventActions for the popover shown above:
This takes the form "Button Name<comma> Script Name". Here is the $sc_CustomEventActions for the popover shown above:
Overview: What are Custom Actions
Overview: What Are Custom Actions?
Reveal the actions drawer by clicking the gear icon in the lower right of the event's popover. You can add as many custom actions as you'd like.
Reveal the actions drawer by clicking the gear icon in the lower right of the event's popover. You can add as many custom actions as you'd like: your list of actions will scroll if it exceeds the length of the drawer.
Take a look at our example script "Go To Event Record From WebViewer". That shows you the variables you'll have access to and how to determine the source number from the source name in $source.
Notice also how you can call the script "Find Event by ID (ID)" to jump to your event by passing in the variable $eventID as a script parameter.
Overview
Overview: What are Custom Actions
Adding Your Own Actions
sdasda
>> How to create custom actions in the "Load Source Settings at Startup..." script. Screenshot of actions.
How to Create Your Own Actions
You'll define your action buttons by editing the script "Load Source Settings at Startup...". For each source in that script you'll see a variable called "$sc_CustomEventActions". The definition of that variable declares the names of your action buttons and the names of the scripts they should run.
This takes the form "Button Name, Script Name". Here is the $sc_CustomEventActions for the popover shown above:
"View Event Record, Go To Event Record From WebViewer";
"Sample Custom Action, Custom Action Example" ;
""
)
This means that DayBack will draw an action button named "View Event Record" and when it's clicked it will call the FileMaker script named "Go To Event Record From WebViewer".
Tips for Writing Your Action Scripts
The scripts you call with custom actions will have access to a few local variables you can use to find events and manipulate them. These variables will already be declared when your script starts to run:
>> What does "watch event for changes do" as an action parameter.
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover.png
Overview
Custom actions let you add your own buttons to the calendar. These buttons run your own FileMaker scripts and are a great way to extend the calendar's capabilities.
Each source gets it's own action buttons, and our sample events table comes with two: one to jump to the event's record in it's own FileMaker layout, and another to just show a simple dialog.
https://www.seedcode.com/rootimages/stikipad/dayback/customactionspopover
Reveal the actions drawer by clicking the gear icon in the lower right of the event's popover. You can add as many custom actions as you'd like.
Adding Your Own Actions
sdasda
>> How to create custom actions in the "Load Source Settings at Startup..." script. Screenshot of actions.