Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
After creating a custom form, it's typical to check which button is pressed and handle the gathered data accordingly.
To become familiar with this functionality, create a new custom form containing the following elements:
The purpose of the flow is to check which form action is pressed. When the Save action is pressed, the flow stores the gathered data into an Excel spreadsheet. When the Cancel action is pressed, the flow stops and returns an error.
To implement this behaviour:
Deploy an If action and check whether the ButtonPressed variable contains the value Save.
Inside the if block, launch an Excel spreadsheet. For this example, the spreadsheet must contain two columns for the name and last name of the customer.
Use a Get first free column/row from Excel worksheet action to find the first available row in the spreadsheet.
Deploy a Write to Excel worksheet action and write the customer's name in the first column of the first available spreadsheet row.
All the form inputs are stored in the CustomFormData custom object variable. To access the value of a specific element of the custom object, use the following notation: %CustomFormData['ElementID']%.
Note
You can find more information regarding custom objects in Advanced data types
Use a second Write to Excel worksheet action to write the customer's last name in the second column of the first available spreadsheet row.
Save and close the Excel file using the Close Excel action.
Add an Else action inside the if block and use a Stop flow action to stop the flow when the if statement is false.
When running the desktop flow, the displayed form will be similar to the one presented in the following screenshot:
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Module
Request multiple user inputs using custom forms - Training
Discover how to access and utilize form data in other actions within your desktop flow, enhancing the functionality and efficiency of your processes.
Documentation
Message boxes actions reference - Power Automate
See all the available message boxes actions.
Create custom forms - Power Automate
Create custom forms
Delete columns from a datatable - Power Automate
Delete columns from a datatable