15 Feb 2020

Cascading Events – Link Events Together on Your Calendar

Cascading Events in DayBack

When working with projects, many times you may have events with dependencies. If one event’s scheduled time changes, you probably want any dependent events in the future to adjust accordingly. DayBack’s custom event actions allow you to have that kind of automated control over your events. I’ve put together a custom action specifically for cascading. Add this action to your own calendar and you’ll be able to customize the rules by which changes cascade to downstream events.

How It Works

Here’s an example of cascading events in action: Whenever a change is made to an event, the action applies the same change to any downstream events (any events later than the changed event) which are visible in DayBack. “Visible” in this case, means any events you can see in the current date range and which match the current filters. Within those events, the action will apply your change to any events matching the criteria specified in the action. (We’ll show you how to specify criteria below.) Note that this action only applies to changes made to the date and time of an event: changes to resources, titles, etc. do not cascade through the project.

Be Careful

This custom action is very powerful: depending on the configuration you set, this action has the capability to modify each visible event on the calendar. To test your configuration, it might be a good idea to create a new calendar with some test events and try out the action on that source. The Undo button is your friend and can help revert any mistaken changes due to misconfiguration. If you feel like you would like to give yourself more time to be able to undo a cascade, you can change the “5000” value on line 343 to your preferred delay in milliseconds:

//show a custom undo modal 
helpers.showMessage(revertMessage, 0, 5000, null, revertChanges);

 

Add This to Your Calendar: Changing Criteria for What’s “Linked”

For this feature, there’s only one On Event Save custom you’ll add DayBack.  You can download the code for the action here (updated March 24, 2020, to coexist with DayBack’s multiple-selection feature).

. (Please review the notes here if this is the first event action you’ve added to your calendar: custom event actions.) Before you add this to the calendar(s) you want to trigger it, you’ll want to customize the action to define your criteria for a “linked” event. This is done by modifying the “cascadeOptions” object defined on lines 23-125 of the action. There are descriptions and examples for each of the options within that section to help guide your settings, but feel free to reach out if you have any questions. We suggest using a code editor like Visual Studio Code or Atom to make things easier. Here’s the configuration we used in the movie above:

propertyFilters: {
      resource: null,
      status: {
        anyMatch: true,
        matchingGroups: null
      },
      contactID: null,
      contactName: null,
      projectID: null,
      projectName:{
        anyMatch: true,
        matchingGroups: null
      },
      location: null,
      tags: null,
      allDay: null,
      titleEdit: null,
      description: null,
      done: null,
      customFields: null
    }

Keep in mind that events must be visible to be considered for cascading, so make sure the entire range of dates you’d like to cascade are visible. Horizon view’s long time scale is perfect for this. A few more details when configuring the linked criteria:

  • Though we’re demonstrating this on horizon view, cascade actions will work on edits made in any of DayBack’s calendar views.
  • Line 27 gets this action ready for an upcoming feature: manually selecting more than one event and then editing the selected items in a batch. Leave that line as-is to support this new feature; disable the line if you don’t want to support batch editing.
  • Lines 35 and 38 restrict the action to operate on events in the same calendar source (just Salesforce events, or just Google events, for example). Remember that while you define is On Event Save action for a particular calendar, that only determines which edits can trigger the action, it’s the code inside the action that determines which events the triggered cascade is applied to.
  • Restrictions made to lines 35 and 38 combine with the more specific restrictions in lines 110 through 129.

If you’d like help implementing this custom action or any other customization into your DayBack calendar, don’t hesitate to reach out and we can schedule some time to chat.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.