Assign

This activity is utilized to assign values to variables or arguments, supporting various
datatypes such as String, Boolean, Int32, object, array, and more. It also serves
to increment variable values within a loop or to calculate the sum of multiple
variables, assigning the result to another variable.

Technical Reference

 

 

 

    MISC

Display Name: Displays the name of the activity. The activity name can also be customized to help in troubleshooting.

To: This parameter indicates to provide the variable to which the value needs to be assigned.

 

You have the option to hardcode the values in any variable format.

 

This accepts all variable datatype.

Value: This parameter indicates to provide the value that needs to be assigned to the variable in the “To” field.

 

You have the option to hardcode the values in any variable format.

 

This accepts variable datatype depending on the datatype of the “TO” field.

*Represents mandatory fields to execute the workflow.

Here’s an example of how the “Assign” activity works –

In the following example, I will calculate the total cost of items based on the quantity,
utilizing the "Assign" activity. Here I have created three variables such as “ItemPrice,
Quantity, and Total cost” with “Int32” as datatype for all three.

Example:

1.       Create a new solution or open an existing solution.

2.       The “Primitives” features will be installed by default during the installation of
the “Designer”.

3.       Drag and drop the “Assign” activity to the workflow and set it as start node.

a.       In the first assign, I am entering the “To” as “ItemPrice” and “Value” as “32”.

4.       Now, I am adding another “Assign” activity below to the first one to assign
values to the “Quantity” variable.

a.       Providing the value as “4”.

5.       Then, adding the final “Assign” activity to calculate the values and assign to
“TotalCost” variable.

a.       To perform the action, I am providing the value as “32*4” in the box.

6.       You can add the “Writelog” activity to view the results.

7.       Now, execute the workflow.

Below is the sample output of the activity.