> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowforma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Business rules

> Business rules add logic to FlowForma flows, steps, and questions, controlling when actions run on load, start, save, or completion and in parallel or series.

Business rules are used to add logic to flows at a number of different levels:

* **Flows**: when they are started, loaded, completed, or rejected.
* **Steps**: when they are started, saved, or completed.
* **Questions**: when they are updated.
* **Sub-questions**: when they are updated.

The rules available depend on the level you've selected: for example, you cannot add a pass back rule on "question updated".

All rules are added from the flow designer. The UI changes depending on whether "Form preview" is on or off. If form preview is on, the Add rules section is displayed at the bottom left, under the question section.

<img src="https://mintcdn.com/flowforma/Ttfqzt1QnXujKlYY/images/product/creating-flows/business-rules/overview/business-rules-overview-1.png?fit=max&auto=format&n=Ttfqzt1QnXujKlYY&q=85&s=346d006076bd65e11e226f231538a22d" alt="Adding rules with Form preview on" width="1639" height="820" data-path="images/product/creating-flows/business-rules/overview/business-rules-overview-1.png" />

If Form preview is off, the rules appear on the right-hand side.

<img src="https://mintcdn.com/flowforma/Ttfqzt1QnXujKlYY/images/product/creating-flows/business-rules/overview/business-rules-overview-2.png?fit=max&auto=format&n=Ttfqzt1QnXujKlYY&q=85&s=3e3b339a8a7902ce0b2fb73174e17273" alt="Adding rules with Form preview off" width="1618" height="799" data-path="images/product/creating-flows/business-rules/overview/business-rules-overview-2.png" />

* **Form loaded** rules are executed when you open the form. If you only want the rule to execute the first time a form loads, add conditions to ensure this.
* **Flow started** rules are executed when you start a new flow. A flow is considered started only when the first step of the form is saved or submitted.
* **Flow completed** rules are executed when all the steps in the flow have been completed.
* **Flow rejected** rules are executed when a form is rejected; you can add conditions to further control their execution.
* **Step started** rules are executed at the beginning of a new step. A step is considered to have started immediately after the previous step has been completed.
* **Step saving** rules are executed when you save the form. If the form was created but never saved, the rule executes when you submit the step, as the submit button also saves the information.
* **Step completed** rules are executed when the step is completed (submitted). A step can be submitted more than once.
* **Question changed** rules are executed when you change the value entered into a question. If the question has a default value, the rule only executes when you change that value. The rule executes each time you change the value.

<Warning>
  **Step rules and passback**

  Step rules are affected by passing back for critical information. In this situation, rules on steps from the "step passed back to" through the "step passed back from" are executed a second time, subject to the rule conditions being met.
</Warning>

In a flow, rules are executed in the following order:

1. Form loaded
2. Flow started rules
3. Step started rules
4. Question changed rules
5. Step saved
6. Step completed
7. Flow completed
8. Flow rejected

Rule execution can be broken down further by executing rules in either parallel or series. Rules executed in **parallel** run at the same time (assuming conditions are met), whereas rules executed in **series** run one by one (assuming conditions are met).

By default, when rules are executed, FlowForma checks all the rules, selects those that meet the conditions, and executes them in parallel.

If you have rules that **change items that affect the conditions of other rules**, make sure **set execution in series** is selected.

For example, you have two rules on step completed:

* Set the current user in a person or group question (no conditions).
* Set step assign to (if the value in the person or group question = Paige Turner).

If **set execution in series** is not selected, the first rule executes every time, but the second rule never executes: the person or group field is still empty because the second rule runs before the first has finished populating it.

If **set execution in series** is selected, the first rule executes every time, and the second rule executes only if its condition is met. Because the second rule starts only after the first has completed, the person or group field will have been populated, so if the person is "Paige Turner", the second rule executes and the step assign to takes place.

Additionally, if you have two rules on step completed such as:

* Generate a document.
* [Send email](/product/creating-flows/business-rules/business-rule-types/communications-rules/send-email) with the generated document attached.

It's important to use rule execution in series so the email isn't sent before the document has finished generating, otherwise the email is sent without an attachment.

You can apply conditions to business rules so they only execute when certain conditions are met; if no conditions are added, the rule always executes.

When creating a new business rule, the first section determines **when** the rule executes (load, save, start, complete, or question updated), the second section is for any **conditions** (and can be left blank), and the third section is the **action**. Each rule has its own action.

Once you've entered all relevant detail, click **Save**.
