This article will help you to create a Insert task using workflow which will allow you to add a new row in your sheets. For more information on workflows refer what are workflows
We assume you already have a Micro App created, if not refer here. We will start by adding a new screen with screen type Data Collection and name it as Insert as screen name.
You can add other controls which you want to insert in Sheets. In this example we will be using 2 fields Name and Email Id of the User which we will add it in the Sheet.
- We will add a Submit button to the newly created screen - Insert screen. As shown in above image, For adding a submit button, click on the Controls option on the left side and scroll down to BUTTON section to locate Submit button as show below. Click / Drag & drop the Submit button to add it on the Screen
As shown above is how our current screen look like.
- Once the submit button is added, Workflow icon will get activated. Click on the workflow icon as shown above and Create workflow dialog will open
- Enter your Workflow name and description and click on Create Workflow icon as shown above.
- Click on + icon as shown above and it will open Workflow SELECT TASK Modal.
- Select Update Sheet option as shown above, Enter the Task Name and you can also add a condition when you want to execute this workflow or keep the condition blank if you want to always execute this workflow. Click on Next.
- Select the Sheet Name under WHERE TO UPDATE Dropdown where you want to add the data from current screen or Create a new Sheet as shown above. In above example, Task_List is the sheet name where new record is to be inserted.
- Under WHAT TO DO, select Insert Record.
- Under INSERT DATA section, it lists all the columns present in the selected sheet (In this case Task_List Sheet) and you can assign value to each individual column. For additional fields which you do not want to enter any values you can keep it blank
- Values to the each columns can be assigned in one of the 3 ways by clicking on the F icon as shown above
1) Static data
- Using Static Data - Static data can be any hardcoded value you want to set. For Example you want to set a particular column called status as TRUE() for boolean type value or "Done" for String values or any other functions can be used. For more details Refer Binding Data in Controls using Static data
- Using Sheet - You can also bind data from any other Sheet using LOOKUP. For more details Refer Binding Data in Controls using Sheets
- Using Tasks - All the controls added in your screen is available under INITIATED keyword. In the suggestion shown above, it shows the Controls Unique Name added in the given Screen. Unique Name of each control can be viewed by selecting that control added in screen and once highlighted, it is visible under property section on the right side against Key name - "Unique Name". For more details on Unique Name, Refer Binding Data in Controls using Controls Reference
- In the above example, Unique Name of "Name" control is : "text5" and that of Email id control is : "email1". We want to add "Name" control's value into "task_name" column and "Email" control's value into "assigned_to" column using INITIATED.text5 & INITIATED.email1 respectively as shown in above image.
- Once all values are added as per your need, you can click on Done button.
Testing your workflow
- Now, in order to test this, you will have to Publish this MicroApp. Click on Publish, enter release notes and click on Publish
- Once the App is published, you will have to open the container app and open this MicroApp which will download the MicroApp if not downloaded and will open the same Screen you created with Submit button. Enter Name and Email Id and click on Submit. It will show successfully submitted and Now, Name and Email Id you added will be added/inserted in your sheet (In this example - it will be added in sheet named - Task_List)