When defining the action flow of your action, you can assign values to variables. This behavior is implemented through the Assign element which you can drag onto your canvas from the Action Flow Toolbox.
To assign a value to a variable simply click on the Assign element and set the Variable and the Value properties in the Properties Pane.
To set the variable do one of the following:
Open the drop-down list and select the variable from the suggested variables or from the Select Variable window
Click on the assign icon (visible when you mouse hover the Variable field) and select the variable from the Select Variable window;
Double-click on the Variable field and select the variable from the Select Variable window;
Click on the Variable field and type the variable name directly there.
To set the value do one of the following:
Open the drop-down list and set the value through an expression in the Expression Editor or one of the suggested values
Click on the expression icon (visible when mouse hovering the Value field) to open the Expression Editor and set a value or expression;
Double-click on the Value field to open the Expression Editor and set a value or expression;
Click on the Value field and type the value or expression directly there.
To assign more values to variables within the same assign, repeat the procedure for next empty line of assignment that is automatically added.
When assigning values to variables, it is important to keep in mind that depending on the data type of the variables, they are handled by value or by reference.
Most of the data types are handled by value. This means that variables are using two different memory locations and the value is copied from one location to another. Changes to one of the variables will not affect the value of the other.
The copy of a record by directly assigning the variables will make a copy of the record. The result is that changing the value of one record will not affect the value of the other.
The exceptions to handling by value are the Record List, Binary Data, or Object data types that are handled by reference. This means that assigning a variable to another makes both of the variables to be pointing to the same memory location. Changes to one of the variables affects the value of the other.
See also How Input Parameters are Handled in Actions and Web Blocks.
The copy of a record list by directly assigning the variable of the original list to the variable of the duplicated list will put both variables pointing to the same memory location. The result is that changing the list of one of the variables will affect the list of the other variable.
The right way to do this is to iterate the elements of the original list and add them to the duplicated list. There's also a built-in function that does this job: ListDuplicate().
When assigning attributes between two variables of Record data type, you would normally need to make an assignment for each one of the attributes. However, if you select the (Auto Assign '<variable name>') option of the drop-down list, Service Studio automatically adds for you all the assignments between attributes.
The (Auto Assign '<variable name>') option is only visible when you click in the drop-down list of the Variable and there is already a previous assignment between two variables of Record data type. The assignments are hinted on the previous assignment or on the currentone (if defined). The "hint" algorithm matches the left and the right hand sides of assignments with base on names and data types of the attributes.
If no assignments can be inferred, the Auto Assign option is not available.
This is better explained by looking into the following examples:
CopyRecord.Contact.Name = OriginalRecord.Contact.Name
When you select (Auto Assign 'CopyRecord.Contact') in the drop-down list, new assignments will be added for each unassigned attribute:
CopyRecord.Contact.<attribute> = OriginalRecord.Contact.<attribute>.
You clicked on an new line of assignment. The previous assignment is:
Name = OriginalContact.Contact.Name
Where Name is a local variable of Text data type.
The Auto Assign is not available because the previous assignment is not between two elements of Record data type.
The Auto Assign is not available in the drop-down list because there is no assignment to be based on.
At any moment while defining your Assign you can check which attributes are already assigned in Select Variable window.
About Variables | Select Variable Window | Expression Editor | Assign Properties | Action Flow Toolbox