In the previous article we have seen how to create a simple "Hello World" type of flow. In case you have not read the article, please take a look here. It is pre-requisite for this article. In this flow we will add 2 numbers, yes 2 numbers :-). Here what the flow does is not important, but the concepts behind the flow needs to be understood.
The purpose of this article is to understand following concepts.
- Use of variable resource in flows.
- Use of formula resource.
- As a bonus, we will learn how to use the debug functionality in flow.
Lets start by creating a new flow using the "New Flow" button. We will use the "Screen Flow" option for this tutorial. In the next screen, select the auto layout option just like we did earlier.
Now lets create a few resources in the flow. Click on the "New Resource" button in the Manager pallete. First create a variable named "firstnumber" with the apiname as "firstnumber", data type as "Number". Set the decimal places to "0"
Now create the second variable resource with api name as "secondnumber", Data type as "number" and with 0 decimal places.
Create a formula resource with API name as "sumOutput", data type as "Number" with 0 decimal places.
In the formula box, insert firstnumber with a "+" sign and then the second number.
Now manager toolbox will have all 3 resources listed
Now click "+" in the canvas to add a new Screen Element. Search for the "Number" component. Click it twice to add it on the screen Element. Provide label and API name to the added Number component as shown below. Make both the fields "required".
Provide a label to screen element. Without the label, the flow designer will not allow us to proceed further.
Now click on "+" again to add assignment element
Assign the numnber component input values to the variables we created earlier.
Click "+" again to add a new screen element. Add a number component to this new screen element, so that we can display the output of our addition. Provide a label to the screen element.
Now we will save the flow and debug it. Click on the "Save" button situated on the top right corner.
Provide a name and api name to the flow
Click on debug to start debugging the flow
Select the default options in the screen to start debugging
We will be shown the first screen. Enter any 2 numbers that you would want to add. Debugging output can be viewed on the right hand side of the screen.
On clicking next we will see the output of our addition. In case something goes wrong with the configuration, you will be able to figure it out from the debug logs generated by the flow.
I would highly recommend you to try this very simple flow so that you feel more confident using the flows functionality.
No comments:
Post a Comment