Adding and Configuring your second Task
When developing your Process and the time comes to add another Task, you need to take some things into consideration. All steps in the Process need to have unique names. So, if you add the same Task as a second Task, you need to rename it with a unique name. This is because your second Task will name itself using the same naming convention as the first one. This will generate an error and you will not be able to save or validate your Process. Like in the previous module, we recommend using some kind of preselected naming convention that will describe the Task's objective.
Also, the second Task needs to be connected to the previous Element. This will create the Process flow, and all the Tasks/Elements have to be connected to the previous Elements to work. To do that, you can either select the next Task Element from the Quick toolbar that is highlighted next to the Element when being selected, or you can use the Connection Element to connect your Elements to one another.
If you need to use the previous Task's or Element's result in the next Task, you can reference it by using the #result reference. This reference will take the previous Element's result object, and you can use it as described in the Task's description. Note that there are situations where the #result reference by itself won't work. For example, if the previous step is a Trigger, Expression, or Statement Element. These Elements don't return anything, so there is nothing to reference.
If you have multiple Tasks before your current Task, you can also reference previous Task's results by referencing with the #result[previous Task name] reference. This will enable you to reference a Task that is before the previous Task.
In this example, we are using two separate File Read Tasks to read the content of two files. Then, we use a File Write Task to write a new file, using the content from the first File Read Task and the path from the second File Read Task. In Expression mode, we can access the Files Read content without using curly brackets ({{#result[File Read].Content}}), although it is still possible to do so.
Note that it's important to check the documentation of each Task to determine the type of C# object it returns. All Tasks return a C# object, and you may need to access a specific property. For example, the Files.Read Task returns a C# object with a Content property that contains the content from the read file. You can reference this property using
#result[File Read].Content
The next article is Example on Using low-code references for message creation