APIs and JavaScript in DayBack
DayBack provides both inbound and outbound APIs to enhance its functionality and integrate with other applications. DayBack can be customized using JavaScript code, and most of our popular extensions and integration examples available in our open source extensions library.
Inbound APIs:
Inbound APIs allow you to create buttons on your Salesforce pages or FileMaker layouts that control DayBack's behavior. These buttons can manipulate DayBack's URL to perform actions such as navigating to a specific event or view, or filtering for a particular campaign. Learn more about adding DayBack buttons to your layouts.
Outbound APIs:
Outbound APIs, also known as webhooks, enable you to run your own scripts from within DayBack or call routines in other applications. Most outbound calls are triggered by button actions, which are available within an event's popover.

Ways to Add Custom Code to DayBack
If you're not already familiar with various customizations you can add to DayBack, here's a brief overview of the three major types:
- Custom Button Actions:
- Custom button actions are available from DayBack's event popover and can be used to perform event-specific tasks, such as starting a Zoom meeting, sending an email, or navigating to the event's native record in Salesforce or FileMaker.
- Custom Event Actions:
- Custom event actions are triggered by event-related changes occurring within the calendar, such as editing, creating, or deleting events. These actions trigger automatically when the user performs an action related to the creation, scheduling, or modification of an event record.
- Custom App Actions:
- Custom app actions affect DayBack's loading behavior, influencing the retrieval and display of data, filters, and resources, and when the user navigates between different views.
The remainder of this article describes the JavaScript libraries and data tokens available for use within all action types.
In this article
Using JavaScript In Custom Actions
DayBack custom actions support most standard JavaScript functionality. However, the global window object is not directly accessible within the scripting environment.
You can still call many browser-provided functions, but they must be referenced without the window. prefix. For example:
- Use
open()instead ofwindow.open() - Use
close()instead ofwindow.close() - Use
alert()instead ofwindow.alert() - Use
location.hrefinstead ofwindow.location.href
Aside from this restriction, most JavaScript constructs and APIs behave as expected within DayBack custom actions.
Launching Your Code
All custom code in DayBack is executed through a trigger-based event model, comprised of app action triggers and event action triggers. Instead of manually initializing scripts, your code runs automatically when DayBack reaches specific stages in its application lifecycle. For example, custom code can be triggered when:
- A calendar loads
- The user changes views
- Events are rendered on the calendar
- An individual event is opened
Because of this event-driven architecture, you do not need to write manual initialization code, such as onload handlers or jQuery $(document).ready() functions. DayBack automatically runs your code when the appropriate trigger occurs. Custom actions are executed through the following types of triggers:
- Button Actions - Button actions run when a user clicks a custom button in the DayBack interface.
- Event Actions - Event actions run when a user interacts with a calendar event, such as opening, editing, or otherwise interacting with an event record.
- App Actions - App actions run during DayBack’s application lifecycle, such as when the calendar loads or when the user navigates to a different view.
Included Libraries
DayBack also includes popular libraries like jQuery, Bootstrap, and moment.js, which you can use in your custom actions, alongside DayBack's extensive Objects and Methods.
Interacting with Salesforce Data and Canvas Environments
DayBack provides the following two integration layers for working directly with Salesforce Data and the Canvas App environments.
Running Salesforce SOQL Queries from DayBack
DayBack’s Salesforce integration is built on top of the Canvas JavaScript SDK provided by Salesforce. The Canvas SDK provides the underlying authentication and communication layer that allows a Canvas application, such as DayBack, to interact securely with Salesforce.
On top of this foundation, DayBack provides a Salesforce Client library that simplifies common Salesforce data operations. The Client library is implemented using the Canvas SDK but exposes a higher-level API designed specifically for working with Salesforce records from DayBack custom actions in both the Salesforce Canvas, and Salesforce Connect environments.
Using the Client library, you can perform common data tasks such as:
- Querying records using SOQL
- Creating new records
- Updating existing records
- Deleting records
- Retrieving records by Id
- Calling Salesforce REST endpoints
In this sense, the Salesforce Client library acts as a convenience layer built on top of the Canvas SDK, providing simplified methods for typical data access workflows. Please see the library documentation for a list of all supported methods.
All operations execute in the context of the currently authenticated Salesforce user. As a result, the success of any request depends on the user's assigned permissions and object access rights.
Interacting Directly with the Salesforce Canvas Environment
By contrast to the Salesforce Client library, used for data-related tasks, the Canvas JavaScript SDK itself operates at a lower level and focuses primarily on communication between the DayBack Canvas iframe and the surrounding Salesforce Lightning interface. It exposes the core mechanisms used to exchange context information, authenticate requests, and coordinate interactions between the embedded DayBack application and the Salesforce.
Because of this, the Canvas SDK is typically used when implementing UI-level integrations, such as:
- Responding to browser or container window resize events
- Opening Salesforce Lightning modal dialogs
- Subscribing and reacting to custom events, such as launching Salesforce Flows from within DayBack.
- Coordinating UI behavior between the DayBack iframe and the Salesforce Lightning client
To simplify access to the underlying Canvas SDK, DayBack provides two helper functions:
fbk.client()- Returns the Salesforce Canvas Client object, which is used to authenticate and execute AJAX requests against Salesforce APIs.fbk.context()- Returns the Canvas Context object, which contains metadata about the current environment, including:- The authenticated user
- The Salesforce organization
- Relevant service endpoints and URLs for REST API calls
These objects are required when making authenticated requests to Salesforce through the Canvas SDK. For detailed documentation on available Canvas methods and usage patterns, refer to the Canvas JavaScript SDK Function Reference.
For practical examples of using fbk.client() and fbk.context() in DayBack custom actions, see the "Create a New Salesforce Record from a Google Calendar Event" example in Google Calendar Actions in Salesforce.
Using data tokens in Salesforce and FileMaker
DayBack allows you to specify data tokens, which are replaced by event data when a custom action is run. This is useful for passing event data to other services.
- Data tokens are wrapped in double brackets with the mapped field name, e.g.,
[[DataToken]]. - Tokens use the names assigned during field mapping in the source settings.
Example URL:
http://www.somewebsite.com?id=[[Id]]&date=[[StartDateTime]]
When using data tokens in JavaScript, wrap the token in quotes to avoid errors if the value is empty. This ensures all data tokens are treated as strings:
var eventID = "[[Id]]"; alert(eventID);
For boolean values like allDay , use a string comparison:
var isAllDay = "[[IsAllDayEvent]]" === "true"; // Evaluates to a boolean
Using Data Tokens with Google Calendar
Since no field mapping is necessary for Google Calendars, you'll use DayBack's own name for each data object when writing custom actions for your Google events. Here are the names of each of the properties you can reference in a custom action for a Google Calendar event:
eventIDallDaystartendtitletitleEditdescriptionresourcestatuslocationcontactIDcontactNameprojectIDprojectName
By following these guidelines, you can effectively use JavaScript and data tokens to extend the functionality of DayBack and integrate it seamlessly with other applications.
Using Custom Fields in Your Custom Actions
When using JavaScript to access your custom fields inside Event Actions and Button Actions, you need to reference the custom field using the numerical ID assigned by DayBack. This ID is shown in the Custom Fields tab as the "ID for Calendar Actions".
For example, in the screenshot below, you'll see the ID for the field named truckNumber looks like 1721951289977-5615655122 .

Learn how to Access Custom Fields in Your Custom Actions
For a comprehensive overview of working with custom fields using JavaScript, check out our article on Working with Custom Fields in Custom Actions.
Learning Resources
Available Objects and Methods
Explore the JavaScript objects and methods you can utilize in your custom actions at Objects and Methods for Custom Actions.
Sandbox for Testing
Custom actions provide an excellent environment for experimenting with new code and testing queries. For example, check out how DayBack's Jason Young uses custom actions to console log query results in Testing SOQL Queries in DayBack Calendar.
Draft Mode
For testing App Actions or Event Actions, we recommend using Draft Mode. This mode allows you to make custom changes that are only active for your user session. This mode is great for testing code changes without affecting other users. Drafts and be saved, disabled, reenabled, and then applied to production when your code changes are ready for production user.