Logo preload
close Logo

Introducing Fulcrum Data Events

March 30, 2016

Data Events allow users to perform specific ​actions​ when certain ​events​ are triggered. Actions can include things like custom alerts and validation messages, setting field values, choices, labels, descriptions, requirement & visibility settings, HTTP requests and more. Event triggers include things like record loading, editing, validating, saving, value changing, and more.

This new functionality enables listening for record changes, programmatically changing values, as well as building dynamic hyperlinks, writing custom quality assurance logic and much more!

‍How It Works

You can think of Data Events as an extension of calculation fields. While calculation fields allow you to define dynamic expressions for a particular field, data events allow you to define actions for the entire record. You have access to all the existing expressions, in addition to many new functions for building out truly custom workflows. When building your app, you will see a new “Data Events” button in the app builder’s right sidebar. Clicking this launches a window similar to the expression builder for calculation fields. This is where you define data event triggers and actions.

Data Events Builder

In the screenshot above, we’ve configured a data event for automatically changing the record’s status any time the record is saved. This is a very basic example, but shows how you can build custom workflows with a little bit of JavaScript. We’ve setup a listener for the save-record event, which calls the changeStatus function when the record is saved. Inside the changeStatus function, we are calling the SETSTATUS function with a status parameter of ‘inspected’.

This could be expanded to programmatically set the record status based on values from other fields or even filter the list of available status options based on the user or their role. The intent of the Data Events framework is to give additional tools for automation and customization, effectively giving administrators the ability to modify the behavior of the Fulcrum mobile apps to fit their workflow.

New Events

We’ve exposed a bunch of new event triggers that you can hook into within your apps:

Record / Repeatable Events
  • ‘load-record’ / ‘load-repeatable’ – Triggers when the record / repeatable editor is displayed
  • ‘new-record’ / ‘new-repeatable’- Triggers when a new record / repeatable is created, after ‘load-record’ / ‘load-repeatable’
  • ‘edit-record’ / ‘edit-repeatable’ – Triggers when a record / repeatable is edited, after ‘load-record’ / ‘load-repeatable’
  • ‘save-record’ / ‘save-repeatable’ – Triggers immediately before a record / repeatable is saved and after it’s been validated
  • ‘validate-record’ / ‘validate-repeatable’ – Triggers right before the record / repeatable is saved to check any validations
  • ‘change-geometry’ – Triggers when a record’s / repeatable’s geometry changes
  • ‘change-project’ – Triggers when a record’s project changes
  • ‘change-status’ – Triggers when a record’s status changes
  • ‘change-assignment’ – Triggers when a record’s assignment changes
Field Events
  • ‘change’ – Triggers when a field’s value changes
  • ‘click’ – Triggers when a hyperlink field is tapped
Media Events
  • ‘add-photo’ – Triggers when a photo is added
  • ‘add-video’ – Triggers when a video is added
  • ‘add-audio’ – Triggers when an audio clip is added

New Actions

After registering an event to listen for, you’ll generally want to take some type of action. Actions typically fall into the following categories:

Display A Message
  • ALERT – Displays a message as an alert popup
  • INVALID – Displays a validation error message and prevent the record or repeatable item from being saved
  • PROGRESS – Displays a non-dismissible progress message (useful when loading external data)
Set Form Elements
  • SETDESCRIPTION – Sets the description of a field
  • SETHIDDEN – Sets the visibility of a field
  • SETLABEL – Sets the label of a field
  • SETMAXLENGTH – Sets the maximum length for a field
  • SETMINLENGTH – Sets the minimum length for a field
  • SETREADONLY – Sets a field to be read-only or editable
Set Field Values
  • SETLOCATION – Sets the location of the record
  • SETPROJECT – Sets the project of the record
  • SETSTATUS – Sets the status of the record
  • SETVALUE – Sets the value of a field
Set Field Options
  • SETCHOICEFILTER – Filters the choices in a choice field
  • SETCHOICES – Sets the available choices for a choice field
  • SETSTATUSFILTER – Sets the available choices for a status field
Interact With External Services
  • OPENURL – Opens a URL for a website or mobile app
  • REQUEST – Performs an HTTP request and executes the callback on completion

‍Exploring The Possibilities

Glancing over the events and actions above highlights just how powerful data events are. We’ve been listening to customer feedback for more advanced control over the entire data collection workflow and have worked hard to implement a flexible solution that ultimately gives you control over exactly what happens when your team collects data in Fulcrum. You can build out simple extensions or construct highly sophisticated applications with these components using standard JavaScript. This is one of our biggest and most exciting features to date and we are super excited to see the innovative workflows our users start developing!

Data Events will be enabled for all Professional Plans in the coming weeks. Stay tuned as we will be updating our documentation and developer guides to include more information on this exciting new feature.