# Workflow Automation: The Sanity Check

With the Workflow Automation design, **Filters** determine if a flow should run. When there are conditions required on collected items or even after completed actions, an **If Statement** can be set up on the flow. Use the **Sanity Check** to start the statement and close it using the **\</> End If** action.

Use the **IF(Sanity Check)** to create a custom evaluation in PHP notation to determine if the flow should continue to run after collecting referenced data.

Example:

First, add the **Get Referenced Item(s)** action and connect it to *App A*

![Alt text](https://www.progress.com/podio/documentation/assets/6359e282059fdb3e4222ac066f3e4b53/image-261.png)

Then add the **Sanity Check**. Think of this as a **filter** written out in a PHP equation. Don't forget to use the **token selector** for variables.

![Alt text](https://www.progress.com/podio/documentation/assets/af3c8cff0910eab6c82208aa59bbb4ed/image-262.png)

Add the **Action** required for your workflow.

Multiple **If Statements** can be placed into a flow by using the **End IF** action.

![Alt text](https://www.progress.com/podio/documentation/assets/a89e33a2592b939849a6b45eff94176a/image-263.png)

**Need to test the calculation??** Run a check using Podio Item data and the feature **Simulate Vars**

## Did you know you can also use the Sanity Check to check for Flow Errors?

Add a **Sanity Check** as the Final Step in the flow. Using a PHP Calculation and the Error Token, create a calculation to check that the error code is not empty.

![Alt text](https://www.progress.com/podio/documentation/assets/40bb4b55910acf0c5385c22f95508689/image-264.png)

Add an action to perform when there is an error, for example, a Comment Action.

![Alt text](https://www.progress.com/podio/documentation/assets/b174cc59a0d3068cc4ca9bccd2ced996/image-265.png)

Don't forget to close your If Statement with an End IF

Now, any time the flow runs, creating an error, a comment will be added to the item.
