
To be productive, your users need a calendar view optimized for their individual workflow. Once you’ve configured DayBack to tell the right stories to each user, you can save this setup as a default bookmark. Using bookmarks, you can snap to specific views and filters, easily switching between workflows when selecting a different bookmark. Now your users can arrive at precisely the scenario they’re charged with scheduling.
And to ensure that each of your employees starts off with the best view when they first open DayBack, you can set up a company-wide default bookmark using a custom app action.
Or, since your organization may have groups that follow different workflows, you may need the ability to configure a different default view for each individual, role, department, or team. The simple custom app action described here gives you this level of control and lets you tailor each user’s start-up experience.
Getting Started with Calendar Bookmarks
If you’re new to bookmarks, check out this article for a complete overview of bookmarks and their many cool features. And for an overview of customizing DayBack using app actions, check out this link on custom app actions for a library of custom actions and installation instructions.
Create a new Default Bookmark
Setting up a default bookmark is easy. First create a bookmark and then copy its URL.

The URL might look something like this: https://app.dayback.com/#/?bookmarkID=1593203345200U3927404528
The string 1593203345200U3927404528
is the Bookmark ID. Save this ID, or copy it to your clipboard.
Add the SetDefaultBookmark.js App Action to Your DayBack
Navigate to Admin Settings and the find “App Actions” in the left-hand sidebar. Create a new “On Sources Fetched” action, set “Prevent Default Action” to Yes and then paste in the code below.
// Set Default Bookmark V1.0 // Purpose: // Sets a default bookmark view for the whole organization or // allows you to specify a different bookmark by user // Action Type: On Sources Fetched // Prevent Default Action: Yes // More info on On Sources Fetched actions and objects here: // https://docs.dayback.com/article/140-custom-app-actions // Declare globals var options = {}; var inputs = {}; try { //----------- Configuration ------------------- // Seconds to wait to allow this action to run before reporting an error (set to 0 to deactivate) options.runTimeout = 8; // Specify the default bookmark for all users inputs.defaultBookmarkID = '0001606195000000ABC0001'; // Specify a list of usernames with the Bookmark ID that // should be loaded for that user. Example format: // // inputs.defaultAccountBookmarkID = { // '[email protected]': '0001606195000000ABC0001', // '[email protected]': '0001606195000000ABC0002' // }; inputs.defaultAccountBookmarkID = { '[email protected]': '0001606195000000ABC0002' }; //----------- End Configuration ------------------- } catch(error) { reportError(error); } //----------- The action itself: you may not need to edit this. ------------------- // Action code goes inside this function function run() { // validate configuration if (!validateConfiguration() ) { return confirmCallback(); } // Get current account and go to account-specific bookmark, or to the global default var account = seedcodeCalendar.get('config').account; if (inputs.defaultAccountBookmarkID && typeof inputs.defaultAccountBookmarkID === 'object' && inputs.defaultAccountBookmarkID.hasOwnProperty(account) ) { seedcodeCalendar.init('bookmarkID', inputs.defaultAccountBookmarkID[account]); } else if (inputs.defaultBookmarkID && inputs.defaultBookmarkID.length > 1) { seedcodeCalendar.init('bookmarkID', inputs.defaultBookmarkID); } return confirmCallback(); //----------- Action-specific functions ------------------- // configuration validation helper function function validateConfiguration() { // make sure we have defined a list of calendars if ((!inputs.defaultBookmarkID || typeof inputs.defaultBookmarkID !== 'string') && (!inputs.defaultAccountBookmarkID || typeof inputs.defaultAccountBookmarkID !== 'object' || Object.keys(inputs.defaultAccountBookmarkID).length === 0) ) { return utilities.showModal( 'Error Running Custom Action', '<p>There was a problem running the action "<span style="white-space: nowrap">' + action.name + '</span>"</p><p>Error: Please specify a default bookmark ID for the company or a list of user bookmark defaults.</p><p>This may result in unexpected behavior of the calendar.</p>', null, null, 'OK', confirmCallback, null, null, true, null, true ); } // config is valid return true; } } // end run() //----------- Run function wrapper and helpers - you shouldn't need to edit below this line. ------------------- // Variables used for helper functions below var timeout; // Execute the run function as defined above try { if (!options.restrictedToAccounts || !options.restrictedToAccounts.length || (options.restrictedToAccounts && options.restrictedToAccounts.indexOf(inputs.account) > -1) ) { if (action.preventDefault && options.runTimeout) { timeoutCheck(); } run(); } else if (action.preventDefault) { confirmCallback(); } } catch(error) { reportError(error); } // Run confirm callback when preventDefault is true. Used for async actions function confirmCallback() { cancelTimeoutCheck(); if (action.callbacks.confirm) { action.callbacks.confirm(); } } // Run cancel callback when preventDefault is true. Used for async actions function cancelCallback() { cancelTimeoutCheck(); if (action.callbacks.cancel) { action.callbacks.cancel(); } } // Check if the action has run within the specified time limit when preventDefault is enabled function timeoutCheck() { timeout = setTimeout(function() { var error = { name: 'Timeout', message: 'The action was unable to execute within the allotted time and has been stopped' }; reportError(error, true); }, (options && options.runTimeout ? options.runTimeout * 1000 : 0) ); } function cancelTimeoutCheck() { if (timeout) { clearTimeout(timeout); } } // Function to report any errors that occur when running this action // Follows standard javascript error reporter format of an object with name and message properties function reportError(error) { var errorTitle = 'Error Running Custom Action'; var errorMessage = '<p>There was a problem running the action "<span style="white-space: nowrap">' + action.name + '</span>"</p><p>Error: ' + error.message + '.</p><p>This may result in unexpected behavior of the calendar.</p>'; if (action.preventDefault && timeout) { confirmCallback(); } else { cancelCallback(); } setTimeout(function() { utilities.showModal(errorTitle, errorMessage, null, null, 'OK', null, null, null, true, null, true); }, 1000); }
Now paste your Bookmark ID into the configuration section of the app action, replacing the example ID in the code above. You can set your bookmark as a company-wide default or specify individual default bookmarks for each user account in your company. Here’s the relevant section of code:
// Specify the default bookmark for all users inputs.defaultBookmarkID = '0001606195000000ABC0001'; // Specify a list of usernames with the Bookmark ID that // should be loaded for that user. Example format: // // inputs.defaultAccountBookmarkID = { // '[email protected]': '0001606195000000ABC0001', // '[email protected]': '0001606195000000ABC0002' // }; inputs.defaultAccountBookmarkID = { '[email protected]' : '0001606195000000ABC0002' };
Double check that you’ve this action to run On Sources Fetched, with Prevent Default Action set to Yes.
Conclusion
Adding custom app actions can be an easy way to customize the user experience for each individual. If you’ve found this app action useful or have questions about customizing it for your workflow, please get in touch. We’d love to hear from you.
Leave a Reply