Static Resources and Visual Force Pages

Note that this document describes "Static Resources." These are distinct from "Resources" that can be associated with an event, such as salespeople or delivery trucks . Static Resources in Salesforce are records that developers can use to extend DayBack's functionality.

Alternate DayBack JavaScript

DayBack includes an example Static Resource named "Alternate DayBack JavaScript" to demonstrate how developers can upload and use their own custom JavaScript. This allows developers to run custom JavaScript outside of the canvas/iFrame, useful for relaying instructions between DayBack and Salesforce in specific ways.

Originally, Static Resources were introduced before App Actions were available, so many tasks that required Static Resources in the past can now be accomplished using actions. However, Static Resources are still useful for certain customizations, particularly when embedding DayBack on a record's page to show events for a specific account.

DayBack's App Actions vs. Static Resources

  • App Actions: Run inside the DayBack iFrame.
  • Static Resources: Used for tasks at the Salesforce level, such as navigation, resizing the iFrame, or opening a modal. These actions need to happen in the JavaScript within the Static Resource.

DayBack includes built-in features for common tasks like modals in the Static Resource that ships with DayBack, but developers may want to add their own JavaScript.

Pub/Sub Model

DayBack uses a publish/subscribe model, allowing JavaScript events to be published from DayBack to the Visualforce (VF) page, where they can be executed. This is similar to calling a FileMaker script from DayBack. The "script" to be called must be set up as a subscription in the Static Resource.

We sometimes use a custom Static Resource if a customer wants custom navigation. For example, we can replace the Static Resource's navigation methods so the Salesforce page opens in a new tab.

Custom Static Resources

You can't edit the stock Static Resource that comes with DayBack, but you can replace it and specify its name in the custom setting. An Apex class runs when the VF page loads, checking the custom setting to load the alternate Static Resource if specified.

Pre-Load DayBack with URL Parameters

To specify URL parameters with DayBack first loads, set them in the Static Resource. Since DayBack is in a special iFrame, you can't specify the parameters directly in the iFrame URL. Instead, set them in the Static Resource, and they will be "published" to DayBack and applied.

Legacy Methods and Examples

Older versions of DayBack didn't include modal methods in the Static Resource. Previously, developers needed to add these methods manually. While some of these methods are now standard in DayBack, the documentation related to Static Resources is still relevant today.

For further details on using Static Resources and coding custom methods, please refer to the old instructions in this blog post: Lightning Modal Boxes in Salesforce. The page provides a good description of how Static Resources work.