Set Value Function
The Set Value function allows us to store transformed attribute values or entire records for later use in Syncari or destination synapse records. There are two options, or attribute types, when using this function:
- This Attribute: Saves the value directly to the attribute.
- 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 attribute options and the consequences of choosing one over the other.
Components of the Set Value Function
Attribute Reference:
- Display Label: An optional attribute where you can provide a descriptive name of the lookup being performed.
- Description: An optional attribute where you can explain the purpose of the lookup in more detail.
- Select Attribute: A required attribute where you decide if you'll overwrite the current attribute value with a new value or save the new value in a temporary variable. Existing attribute is always the default options for this attribute.
- New Value: A required attribute where you'll specify what value should be saved to the existing attribute or in a temporary variable. This can either be a hardcoded value or dynamically inserted value via a token (more on this later).
- Multivalue Attribute: 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 attribute 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 attribute pipeline, we are trying to take two separate attributes from our Hubspot synapse - First Name and Last Name - and merge them together in Syncari. Below are the steps:
- Source Attributes: This attribute pipeline ingests attribute values from two different source attributes - First Name and Last Name
- Capitalize Function: Both first and last name values are run through the Capitalize function
- Temporary Variables: The newly capitalized attribute 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 attribute
- Remember, you must set the value on the existing attribute 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 attribute, 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 attribute 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 attribute, 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 Attributes
In the attribute type, choose This attribute instead of Temporary variable. Ensure the datatype matches the previous nodes' outputs (both are Text). In the New Value attribute, 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 an attribute value - including running any string or math functions on that attribute - you must save the output to the existing attribute 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 attribute value of current record.