How to validate form data in Power Automate: step by step
This tutorial shows how to automatically validate responses from a Form (Microsoft Forms) with Power Automate, log invalid entries in a SharePoint list and notify the submitter. Automatic validation saves time, reduces human errors and ensures that received data are ready for analysis or processing.
Prerequisites
- Microsoft 365 account with access to Power Automate and Microsoft Forms.
- SharePoint list created to log invalid responses (columns: Title, Email, CampoInválido, Erro).
- Form in Microsoft Forms with at least two fields (e.g., Email, Idade).
- Permissions to create flows and access the SharePoint site.
Step 1: Create trigger from the Form
Create a new automated flow in Power Automate with the trigger "When a new response is submitted" (Microsoft Forms). Select the correct Form. This trigger starts the flow whenever a response is received.
Step 2: Get response details
Add the action "Get response details" (Microsoft Forms) to read the filled fields. Connect it to the same Form and to the Response Id from the trigger. This makes the values available for validation.
Step 3: Validate fields with a simple condition
Add a "Condition" action to validate a field. A common example: check if the Email field contains '@' or if Idade is a number within a range. We use expressions in Power Automate for this.
Expression example for valid Idade (18 to 99): and(greaterOrEquals(int(body('Get_response_details')?['Idade']),18), lessOrEquals(int(body('Get_response_details')?['Idade']),99))
For a simple Email check, you can use contains:
contains(body('Get_response_details')?['Email'], '@')
Step 4: Branch when validation fails — log to SharePoint
In the "If no" branch of the Condition (when validation fails), add the "Create item" action (SharePoint). Fill the columns with useful information: Title (for example, Response Id), Email, CampoInválido (e.g., Idade), Erro (short message explaining the problem).
Suggested columns: Title: @{outputs('Get_response_details')?['responseId']} Email: @{body('Get_response_details')?['Email']} CampoInválido: Idade Erro: Idade fora do intervalo 18-99
Step 5: Notify the submitter or team
You can send an email or a Teams message to notify the person who submitted the response or the quality team. Use the action "Send an email (V2)" or "Post a message". Include error details to allow correction.
Example email body: Subject: Error in the Form response Body: Your response has an error in the Idade field: value is not between 18 and 99. Response Id: @{outputs('Get_response_details')?['responseId']}
Step 6: Branch when validation passes — continue process
In the "If yes" branch (validation OK), proceed with the main flow: store final data, update a system, or trigger an ETL process. Make clear that you should only advance when all essential fields passed validation.
Step 7: Handle multiple rules and accumulated errors
If there are multiple validations, create variables to accumulate error messages and, at the end, evaluate whether the error variable is empty. This avoids multiple branching and lets you log or notify with a single consolidated record.
Example logic: Initialize variable Errors (String) = '' If condition fails: set variable Errors = concat(variables('Errors'), 'Idade inválida; ') At the end: condition empty(variables('Errors')) ? flow OK : log error
Verify the result
Submit test responses in Microsoft Forms with valid and invalid values. Check the SharePoint list to confirm that error records appear with the correct data and open the emails/Teams to confirm notifications. Also validate that valid responses follow the main flow without creating error records.
Conclusion
After implementing automatic validation in Power Automate, you reduce errors and ensure that only valid data enter systems. Next steps: add advanced validation (regex for Email), integrate with Power BI to monitor failures or use Dataverse instead of SharePoint. Tip: start with few rules and always log the reason for the error to facilitate corrections.