Set Value Function
The Set Value function allows us to store transformed field values or entire records for later use in Syncari or destination synapse records. There are two options, or field types, when using this function:
- This Field: Saves the value directly to the field.
- Temporary Variable: Stores the value temporarily for later use.
Understanding how the Set Value function operates is crucial for performing and maintaining data transformations and record lookups in Syncari. This section delves into the Set Value function, discussing these field options and the consequences of choosing one over the other.
Components of the Set Value Function
Field Reference:
- Display Label: An optional field where you can provide a descriptive name of the lookup being performed.
- Description: An optional field where you can explain the purpose of the lookup in more detail.
- Select Field: A required field where you decide if you'll overwrite the current field value with a new value or save the new value in a temporary variable. Existing Field is always the default options for this field.
- New Value: A required field where you'll specify what value should be saved to the existing field or in a temporary variable. This can either be a hardcoded value or dynamically inserted value via a token (more on this later).
- Multivalue Field: An optional flag that should be enabled if the value inserted in this function is a list/array.
- Use Empty: An optional flag where you can specify if a blank value is acceptable to be saved on the existing field or in a temporary variable. This is set to false by default, meaning blank values are not saved.
Using Set Value in Pipelines
In Syncari, you can fetch and modify values using functions and actions. However, how do you store these values in Syncari or a destination synapse, or persist them for use by other functions and actions?
In this field pipeline, we are trying to take two separate fields from our Hubspot synapse - First Name and Last Name - and merge them together in Syncari. Below are the steps:
- Source Fields: This field pipeline ingests field values from two different source fields - First Name and Last Name
- Capitalize Function: Both first and last name values are run through the Capitalize function
- Temporary Variables: The newly capitalized field values are stored in two different temporary variables to be later concatenated
- Set Value: Both values stored in temporary variables are concatenated and saved in place on the existing field
- Remember, you must set the value on the existing field in before saving in Syncari or a destination synapse in order for the new value to be persisted.
- Syncari Record: the newly capitalized and concatenated full name is saved to the Syncari field, Full Name
Saving Values to Temporary Variables
In the example from the previous section, we wanted to store the output from a Capitalize function in a temporary variable. Here we'll take a look at how to configure that temporary variable and use tokens to set the new value.
When configuring the Set Value function, choose Temporary variable as the field type. Then, specify its data type and display/API name. Access the token picker by clicking Data Tokens next to New Value.
In the New Value field, you have the option to either hard code a value or dynamically insert one via a token. When you connect an upstream node to a Set Value node, the values from that node will be available via the Token Picker.
Saving Values to Existing Fields
In the Field type, choose This field instead of Temporary variable. Ensure the datatype matches the previous nodes' outputs (both are Text). In the New Value field, put the values of the temporary variables together with a space in between. Click Data tokens to get token values for these variables.
Attaching Set Value to Syncari & Destination Nodes
If you're modifying a field value - including running any string or math functions on that field - you must save the output to the existing field if you wish to save that new value to a record in Syncari or in a destination synapse. Failure to do so will result in Syncari automatically saving the original field value of current record.