DayBackForFileMaker

JavaScript Custom Actions

DayBackForFileMaker.JavaScriptCustomActions History

Hide minor edits - Show changes to output

May 19, 2023, at 04:35 PM by 192.88.134.15 -
Changed line 19 from:
%center% %newwin width=500% [[https://www.seedcode.com/rootimages/stikipad/dayback/loadjsactions.png | https://www.seedcode.com/rootimages/stikipad/dayback/loadjsactions.png]]
to:
%center% %newwin width=500% [[https://archive.seedcode.com/rootimages/stikipad/dayback/loadjsactions.png | https://archive.seedcode.com/rootimages/stikipad/dayback/loadjsactions.png]]
December 12, 2018, at 08:27 PM by 192.88.134.15 -
Changed line 5 from:
While most [[custom actions]] 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 [[VersionHistory | version]] 9.53.
to:
While most [[custom actions | button actions]] run scripts in your FileMaker file, you can also run custom JavaScript to interact with other web services. This is new to DayBack for FileMaker as of [[VersionHistory | version]] 9.53. DayBack's [[event actions]] can also call JavaScript and the exporting technique shown below can be used to export files for event actions also.
October 15, 2018, at 02:18 PM by 192.88.134.15 -
Changed line 5 from:
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 [[VersionHistory | version]] 9.53.
to:
While most [[custom actions]] 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 [[VersionHistory | version]] 9.53.
July 07, 2017, at 06:07 PM by 192.88.135.15 -
Changed line 39 from:
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.
to:
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's 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.
June 03, 2017, at 04:45 PM by 192.88.134.15 -
Changed line 19 from:
%center% %newwin width=500% [[https://www.seedcode.com/rootimages/stikipad/dayback/LoadJSActions.png | https://www.seedcode.com/rootimages/stikipad/dayback/LoadJSActions.png]]
to:
%center% %newwin width=500% [[https://www.seedcode.com/rootimages/stikipad/dayback/loadjsactions.png | https://www.seedcode.com/rootimages/stikipad/dayback/loadjsactions.png]]
June 03, 2017, at 04:42 PM by 192.88.134.15 -
June 03, 2017, at 04:38 PM by 192.88.134.15 -
Added lines 21-22:
-> Make note of the name you give each file as you'll reference these names in step 4 below. And be sure that your file names just contain simple text characters: no punctuation outside of the ".txt" or other characters that are not premised in JavaScript variable names.
Changed lines 31-34 from:
--> "Button Name, [=file:custom-action.txt=]"

-> ...where "custom-action.txt" is one of the files you named and exported in the script you wrote in step 2.
to:
--> "Button Name, [=file:customaction.txt=]"

-> ...where "customaction.txt" is one of the files you named and exported in the script you wrote in step 2.
Changed line 72 from:
(:include DayBackOnline.CustomActionExamples:)
to:
(:include DayBackOnline.CustomActionExamples:)
April 11, 2017, at 06:40 PM by 192.88.134.15 -
Added lines 8-9:

%newwin% [[https://youtu.be/w2MSlerRrSc]]
August 10, 2015, at 08:21 PM by 142.4.217.188 -
Changed lines 13-16 from:
-> 1. Create a new field in the CalendarInterface table called "CustomActions". This should be a repeating text field: give it about 10 repetitions. You'll paste the actual text of each custom action into one repetition of this field. (You can see some example text [[DayBackOnline.CustomActionExamples | here]].

-> 2. Create a new script called "Load JavaScript Actions". This script will name and export a .txt field for each action you'd like to use. Here is a screenshot of the script showing two custom actions being exported:
to:
-> '''1.''' Create a new field in the CalendarInterface table called "CustomActions". This should be a repeating text field: give it about 10 repetitions. You'll paste the actual text of each custom action into one repetition of this field. (You can see some example text [[DayBackOnline.CustomActionExamples | here]].

-> '''2.''' Create a new script called "Load JavaScript Actions". This script will name and export a .txt field for each action you'd like to use. Here is a screenshot of the script showing two custom actions being exported:
Changed lines 19-22 from:
-> 3. Edit the script "Load Source Settings at Startup" and add a new Perform Script step at the top to run the "Load JavaScript Actions" script your just wrote.

-> 4. Continue editing the "Load Source Settings at Startup" script and find the comment "Custom Event Actions..." where you specify the button name and the script to run for each custom action. Where your FileMaker scripts were described like this...
to:
-> '''3.''' Edit the script "Load Source Settings at Startup" and add a new Perform Script step at the top to run the "Load JavaScript Actions" script your just wrote.

-> '''4.''' Continue editing the "Load Source Settings at Startup" script and find the comment "Custom Event Actions..." where you specify the button name and the script to run for each custom action. Where your FileMaker scripts were described like this...
Changed lines 29-31 from:
-> ...where "custom-action.txt" is one of the files you named and exported in step 2.

-> 5. Run your solution's "Upon Opening" script and your custom actions should be working. =)
to:
-> ...where "custom-action.txt" is one of the files you named and exported in the script you wrote in step 2.

-> '''5.''' Run your solution's "Upon Opening" script and your custom actions should be working. =)
August 10, 2015, at 08:20 PM by 142.4.217.188 -
Changed line 27 from:
--> "Button Name, file:custom-action.txt"
to:
--> "Button Name, [=file:custom-action.txt=]"
August 10, 2015, at 08:20 PM by 142.4.217.188 -
Changed line 13 from:
-> 1. Create a new field in the CalendarInterface table called "CustomActions". This should be a repeating text field: give it about 10 repetitions. You'll paste the actual text of each custom action into one repetition of this field. (You can see some example text [[DayBackOnline::CustomActionExamples | here]].
to:
-> 1. Create a new field in the CalendarInterface table called "CustomActions". This should be a repeating text field: give it about 10 repetitions. You'll paste the actual text of each custom action into one repetition of this field. (You can see some example text [[DayBackOnline.CustomActionExamples | here]].
August 10, 2015, at 08:18 PM by 142.4.217.188 -
Changed lines 13-31 from:
coming soon
to:
-> 1. Create a new field in the CalendarInterface table called "CustomActions". This should be a repeating text field: give it about 10 repetitions. You'll paste the actual text of each custom action into one repetition of this field. (You can see some example text [[DayBackOnline::CustomActionExamples | here]].

-> 2. Create a new script called "Load JavaScript Actions". This script will name and export a .txt field for each action you'd like to use. Here is a screenshot of the script showing two custom actions being exported:

%center% %newwin width=500% [[https://www.seedcode.com/rootimages/stikipad/dayback/LoadJSActions.png | https://www.seedcode.com/rootimages/stikipad/dayback/LoadJSActions.png]]

-> 3. Edit the script "Load Source Settings at Startup" and add a new Perform Script step at the top to run the "Load JavaScript Actions" script your just wrote.

-> 4. Continue editing the "Load Source Settings at Startup" script and find the comment "Custom Event Actions..." where you specify the button name and the script to run for each custom action. Where your FileMaker scripts were described like this...

--> "Button Name, FileMaker Script Name"

-> ...your JavaScript custom actions will be described like this...

--> "Button Name, file:custom-action.txt"

-> ...where "custom-action.txt" is one of the files you named and exported in step 2.

-> 5. Run your solution's "Upon Opening" script and your custom actions should be working. =)
August 10, 2015, at 06:14 PM by 142.4.217.188 -
Added lines 1-50:
(:title 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 [[VersionHistory | 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 [[https://www.seedcode.com/filemaker-webdirect-calendar/ | 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:

-> allDay \\
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:)
(855) SEEDCODE
[email protected]
Follow us: