Rules: Conditional Logic for Your Forms

Rules are a powerful feature with Formstack for Salesforce that allows you to take greater control of the data you display and the data entered, all while providing a seamless experience for your end users. Below, we will review the features and functionalities of Rules so you can build powerful forms to help your business grow.


Getting Started 

Navigate to the Edit Rules tab in your form builder.


From here, click the New Rule button to get started.



Creating Your First Rules

If you are familiar with Logic or Salesforce Workflows or Process Builder, Rules operate in a similar way. We want to tell a Rule to look at certain criteria and from there, tell the Rule to perform a certain action.



If we start from the beginning,  we choose the following:

  • If all of the following is true 
    This means all of the criteria we enter below in the Rule must be met for the Rule to fire. This uses AND logic.
  • If any of the following is true
    This means that at least one of the criteria we enter below must be met for the Rule to fire. This uses OR logic.


Choosing a Field


We want to add the actual criteria we want the Rule to look at before firing. Where it says --select an item-- we want to choose a Field on our form to set the criteria. If a field you want to use is not listed, you'll need to add it to your form.


Choosing an Operator

Depending on the field you selected, you'll want to add an Operator. For the majority of Fields, these are the following options you can choose from:

  • is equal to
  • not equal to
  • contains
  • does not contain
  • starts with
  • ends with
  • does not start with
  • does not end with


However, if you are using a Number field, you'll be given the following options instead:

  • is equal to
  • not equal to
  • is less than
  • is greater than
  • is less than or equal to
  • is greater than or equal to


After this, you want to choose the value of the criteria. You can either choose:

  • An existing field on the form. Click "Select an Existing Field" for this option.
  • A value. This is a  typed, static value. Click "Set a Value" for this option.


Adding Additional Criteria 

If you want to add additional criteria, you can hover over the right of the rule and a blue Plus Sign will appear.

If you click on this plus side, you'll see another line appear where you can add criteria by selecting a field, operator and value/field.



Grouping Criteria Together

As you can see above, we're currently telling our rule to look at years of work experience and birthdate. But what if we also want to look at the Source field, regardless of birthdate and work experience? We can do so by clicking the + And/Or button above.


As you can see below, we are now telling our criteria to look at years of Work Experience and Birthdate OR the Source field in order for our rule to fire.


What if we want to add an additional Source? Since our Source field is a Picklist, only one option can be selected at a time. No fear, click the plus sign symbol to the right of where it says Email Marketing to add another line. Here, we will add another line that says Source equals "Advertisement on a Website."


We also want to make sure our criteria says "Or if Any of the following is true." This tells our logic to look at either Source. If wanted it to fire when both values are met, we would change this to "Of if All of the following is met."


Defining the Action

After we add our initial criteria that tell when the Rule should fire, we now need to add the action itself! When adding an action, you have the following actions you can perform:

  • Show
  • Hide
  • Populate
  • Display an Error Message
  • Make Read Only
  • Make Required
  • Make Not Required
  • Set Picklist Values

After we define the action, we can choose if want to apply the action to a Page, Section, or Field. Let's choose to Hide a field on our form. 


Adding a Second Rule

To add a second rule to your form, click the + New Rule underneath your existing Rule. A good rule of thumb when adding the second rule is to think: Do I need to add an action to an additional field?

🔺If you are editing the same field as any of the Rules above, you should add additional criteria to the existing rules and not create a new one.  The rule engine currently requires unique THEN conditions for all rules.  If two rules are attempting to modify the same field with the same property this may cause rules to not execute properly.

When a rule’s condition is not matched then the opposite of the defined rule action is executed by default.

This applies to

  • hide/show actions
  • make required/not required
  • make read-only/not read-only

For example, if the THEN action is to show a field but the IF condition is not met, then the reverse action is automatically executed and the field is hidden (even though this is not explicitly defined).

This can cause confusion if multiple rules have the same field in the THEN action. The end result is likely to be based on the last rule containing the target field in its THEN action.

💡We recommend that all IF conditions to perform a specific THEN action are combined in a single rule.

💡When setting up complex rules, make sure that you have just one rule that contains one show action for one particular field or sectionCreate a rule for a particular then action...then set up all of the conditions that lead to that then action in one rule.





Was this article helpful?
1 out of 10 found this helpful



Article is closed for comments.