When you are building your Apps there can be different actions that would be in response to the clicking of the Action button. At times you would want to perform actions like updating sheets or calling a workflow or creating PDF using the PDF creator. These are typical actions that are primarily server-side actions and that will take place in the background and send a response on success or failure. The Action Flow - Server-side action blocks available on the click action of the Action button, provide you these capabilities to build your customized actions.
Now let us take an example to understand how to use the server-side action blocks. We will take an example to insert educational qualification data for an employee and then send a Slack message informing the employee that the record has been added to the system. So in this case you would need to use the Server-side actions blocks for Update Sheet and Using Connectors, as well as an On-screen Toast action.
So let us add text control for Employee name, Drop down for Highest qualification, numeric control for the percentage, and an Action button to submit the data.
Now in this example, the Add record button (which is the Action button we added) would be triggering the actions to insert the record and depending upon the success or failure of the insert action a Slack message or an Alert would be sent.
To add the actions select the Add record Action button and click Actions. Now click button_click(click) to go to the Action Flow.
Here in this case the insert data to the sheet is an action on the server-side. Hence we would be using the Server-side actions for Update Sheet and also use a Ready Third Party Connector for Slack.
Now under DronaHQ Services block, let us add the Update Sheet action.
Now, Select Sheet from the list. In this example you are inserting a record, hence under Select Operation, click Insert Record. Bind the columns to the controls from the form and click Continue. Provide a self-explanatory Unique Name, and click Finish.
The Update Sheet action has Success or Error as the response. So you can define the respective actions for success and failure. For this example let us simply add an Alert action from the On-screen Actions when the Update Sheet action fails and add another action to send a Slack message on Successful update sheet action.
Now Slack being a third-party connector, you can find it under Server-side actions > Ready Third Party Connectors. Select Slack from the list and click Continue. You get a list of available connectors. Now in this example, as we want to simply send a message, select the Send Message connector. Select the Connected account for authenticating Slack users, and then provide the details for the Select User and Message Fields.
Once done you can also set the variables to use the response from the Slack actions. Add a Resp variable under Add Variables to Use repsonse.
Provide a self-explanatory Unique name and click Finish.
Now you would add a Toast block from the on-screen actions. To understand the response of the Slack Connector earlier, we would be adding this Toast block. The Slack block response would be fetched with the Record_inserted_slack.resp variable in this example here.
The Action flow would be created as shown below.
Once done you can run the form and see the working of your Action Flows.
Now in this example we will add the Employee details and click the Action button, if the record is inserted successfully to your sheet, a slack message would be received and you can also see the Toast that shows what response the slack action block provides.
In this example, if the insert action fails, only then an Alert Block would be triggered.
The data is inserted to the Sheet used for this example.