mergeValuesIntoBodyPartVariables (Team Notifications, Alerts and Collaboration)
Compatible with:
- Purpose
- This command is used to merge the values from dataset into 'variables for substitution' that exist within either the:
- email body (name) is created using the 'createBody' command and incrementally populated using the 'appendBodyPartToBody' command, OR
- email body part (variable) created using any of the commands that start with 'creareBodyPartFrom' command (excluding the createBodyPartFromScreenshot' command)
The string passed into the 'target' field should have all variables that have to be substituted enclosed with a '${' on the left and a '}' on the right so that the variable name string looks of the format ${<variable-name>}. You can have the same variable name more than once in the email body string part string.
The dataset should have the name-value pairs where 'name' is the parameter name and 'value' is the actual value that needs to be substituted. The contents of the 'name' column cells must have the variable names that are NOT enclosed with a '${' on the left and a '}' on the right.
The dataset can have more names (rows) than are needed for substitution (merging of values) into the email body or email body part. All such rows will be ignored. If none of the rows in the dataset have names that match with 'variables for substitution' in the email body or email body part, then there will be no effect of this command on the contents of the email body or email body part.
It is possible for this command to be called more than once with the same target (the email body or email body part) but with a different input to the 'value' field (the 'dataset'). If you have dataset-1 that has 2 name-value pairs and dataset-2 has 3 name-value pairs and the email body or email body part has 5 'variables for substitution', then you call this command once passing dataset-1 as input to the 'value' field for this command, and call the same command a second time but this time feeding as input into the 'value' field dataset-2.
Similarly, it is possible to call the same command more than once passing the same dataset as input to the 'value' field but passing a different email body or email body part as input into the 'target' field. You can do so to store all the name-value pairs that you need for different email body parts in a single dataset, but pass the same dataset as input to different email body parts.
Another option that exists is to first compose the complete email body by appending various email body parts and then calling this command once to get all 'variables for substitutions' merged in with values from the dataset.
Special Data Conditions:
- if the dataset does not have a value for the 'name' column, then the dataset has no impact on the value of the variable in the email body part. It simply does not get replaced and stays as a variable and the email will get sent with that variable not replaced.
- If the 'value' column of the data set does not have a value, then an empty string is used to replace the variable in the email body part. Therefore, you should ensure that the dataset has just the 'name' and 'value' columns and that it has as names all variable names that you want to get replaced with a value.
- If the dataset that is passed as input to this command has more than 2 columns and the first column has as value the variable name used in the email body part, then the value that is used to replace the variable in the email body part will be the concatenation of the contents of all the other columns of the dataset row beyond the 'name' but each value separated by a newline character '\n'. Obviously, the email body will appear unprofessional with such data corruption. So, be careful when passing a dataset as input to this command. Avoid feeding any dataset that has more columns than two and ensue that the dataset has just the 'name' and 'value' columns.
- If the HTML text or plain text or dataset or datafile has user-defined variables or system variables will they get substituted as part of the execution of this command or other commands.
- email body (name) is created using the 'createBody' command and incrementally populated using the 'appendBodyPartToBody' command, OR
- Syntax
- mergeValuesIntoBodyPartVariables(variableName,DatasetName)
- Target
- variableName
- Value
- DatasetName
- Return Value
- N/A