This assumes you’ve read the Data Events Introduction. As an advanced feature, Data Events are only available on the Professional Plan.
This example will carry you through the scenario of using Data Events to expose a hidden field only to Members with specific Roles within your Organization. By default, there are three system-level member roles types included within a Fulcrum account.
Setting Up Data Events
For this example, our app will only have two fields. The Record Label field is seen by all users but we want to keep the Sensitive Field hidden from users in the Standard User role, while allowing it to be seen by Manager and Owner roles.
Data Events button
As you are building your app, you will see a “Data Events” button in the app builder sidebar. This is where you define your data events within the app. Let’s go ahead and click this to enter our expression to define our data event.
With our expression builder modal window open, let’s take a quick tour of the interface.
Form fields - Will reveal a window showing all of your fields within your app.
Function list - Will reveal a window showing all of the built-in custom functions. Clicking the function will add the function to the workspace, clicking the description text for a function will take you to the reference page for that function.
Editor settings - Will reveal a window that allows you to set the settings. You can set the Theme (light/dark), Font Size (12px - 18px) , Code Options (default/strict), and Text Wrapping (On/Off).
Workspace - This is the area where you will write your data event code
Save and Cancel buttons - Click these buttons to either save your code or cancel out of saving your code.
Navigator - This will show you all your data event code, additionally any errors will highlight in the scroll bar to the right of the navigator.
Right-clicking within the editor will reveal some additional options that can be helpful when writing your code.
Go To Definition - Will go directly to the defined function within the code.
Peek Definition - Will open window showing defined function, while keeping your position in the editor.
Peek References - Will open a window showing all the references throughout the code.
Go To Symbol - Brings up a pick list of all functions and variables within the code. Clicking on a function or variable will take you to the location of that variable/function.
Change All Occurrences - Right click on text and have all occurrences of that text throughout the code highlighted so that it can be changed to something else.
Format Document/Selection - Will properly format the entire code or the highlighted code with proper indentations.
checkRole which evaluates if the user’s role is either ‘Owner’ or ‘Manager’ with the
ROLE function, from the Calculation Expressions. If the role matches those values, the ‘sensitive_fields’ hidden settings will be set to
false, exposing the field to those users - for roles such as ‘Standard User’, the field will stay hidden.
If your data events expression is valid, upon saving you will notice the ‘Data Events’ button text now shows ‘Enabled’.
If the expression is invalid, your browser will alert you and you’ll need to debug before being able to save. If you want you can also comment out your code so that you can save what you have so that you can come back and work on the code later.
Additionally, you can see where the possible errors are in your code by looking for the red line under the text and the red lines in the scrollbar on the right side of the editor.