Orchestration
...
Native Actions
Using the Transform Data Native Action
24 min
data transformation, such as converting data into specific formats, has traditionally required expertise in python or jsonata however, with swimlane turbine, you can achieve these tasks easily using the transform data native action within a playbook, without the need for complex coding overview the transform data native action allows you to modify and manipulate data efficiently within your playbooks whether you need to reformat, extract, or combine data, this action provides a user friendly interface to achieve these tasks, enabling seamless automation without requiring advanced coding skills key benefits of the transform data action no coding required perform complex data transformations without writing python or jsonata code visual transformation builder a user friendly interface that simplifies data manipulation versatility supports various transformation types to cater to different data processing needs efficiency streamlines data handling processes, reducing the time required to implement transformations when to use transform data the transform data action is essential whenever you need to modify, extract, or reformat data within your playbook common scenarios include data format conversion parsing json strings from record triggers, record searches, or http responses into json objects converting date/time formats between different representations (unix timestamps, iso 8601, custom formats) converting data types (numbers to strings, arrays to objects, etc ) parsing structured formats like csv, xml, or yaml into javascript objects data extraction and navigation extracting nested properties from complex json objects using jsonata paths accessing deeply nested data structures that require path based navigation plucking specific fields from arrays of objects data filtering and aggregation filtering arrays based on specific criteria or conditions aggregating data (sum, average, min, max) from arrays or object properties removing duplicates or unwanted items from arrays sorting data by value or by object properties data manipulation combining or merging data from multiple sources splitting strings into arrays or arrays into smaller chunks transforming string formats (case conversion, padding, encoding/decoding) normalizing data to ensure consistent formats across different sources data preparation for downstream actions preparing data for http requests, record creation, or other actions that require specific formats transforming api responses into formats suitable for record fields normalizing data from different sources before combining or comparing how transform data integrates the transform data action seamlessly integrates with other playbook components, allowing you to access data from various sources and pass transformed data to downstream actions accessing playbook data transform data can access data from multiple sources within your playbook playbook inputs access playbook input values using $inputs propertyname previous actions access outputs from previous actions using $actions actionname result propertyname published values access published values from other actions using $actions actionname published propertyname loop data access data from loop iterations when used within a loop action variables access variables created by create variables or update variables actions data flow in playbooks transform data fits into the playbook execution flow as follows input stage transform data receives data from playbook inputs previous action outputs published values from other actions loop iteration data transformation stage the action processes data through transformation blocks each block executes sequentially transformations within a block chain together (first → then → then ) multiple blocks can process different aspects of the data output stage transformed data is available for downstream actions other actions can reference the transformation outputs published values transform data can publish specific values for use elsewhere variables transformed data can be stored in variables record operations transformed data can be used in create record, update record, or search records actions integration with other actions transform data commonly integrates with record triggers parse json strings from record field values before processing http request transform api responses into usable formats search records process and filter search results create/update records prepare data in the correct format for record fields condition actions transform data before evaluating conditions loop actions transform data within loop iterations variable actions store transformed data in variables for later use publishing transformed data transform data can publish specific transformation block outputs, making them available to other actions in the playbook published values can be referenced using $actions transformactionname published blockname propertyname this allows you to share transformed data across multiple downstream actions create reusable transformation blocks organize complex data transformations into logical units entrypoint configuration each transform data action has an entrypoint that determines which transformation block executes first this allows you to control the order of transformation execution create multiple transformation paths organize complex transformations into manageable blocks how transform data works the transform data native action uses a block based transformation system where transformations are organized into blocks , and each block contains one or more transformation operations that are executed sequentially understanding transformation blocks each transformation block consists of first transformation the initial transformation that operates on your input data then transformations additional transformations that operate on the output of the previous transformation transformations are chained together, with each transformation receiving the output from the previous one this allows you to build complex data transformations by combining multiple simple operations key concepts block based structure transformations are organized into blocks that can be renamed, duplicated, or reordered sequential execution transformations within a block execute in order (first → then → then ) data flow the output of one transformation becomes the input for the next transformation multiple blocks you can create multiple transformation blocks, each processing different aspects of your data sensitive data blocks can be marked as containing sensitive information, which prevents the data from being displayed in the ui or logs setting up the transform data native action you've already created your playbook, and now you're ready to transform the data from a property here's how to set up the basic transformation from the add panel, drag and drop the transform action onto the playbook canvas select transform data and then click configure the transformation builder window will open if your data has any sensitive information, you can mark it as sensitive by clicking the contains sensitive data checkbox the data is not shown in the ui or in the logs you can rename the transformation block by clicking the pencil icon swimlane automatically updates the block name in snake case if you wish to duplicate the block, click the duplicate icon if you click apply and later return to rename the block, the original name will not change to rename the block, click the lock icon to unlock it for editing renaming the block could potentially break downstream actions if the block is referenced or used elsewhere in the playbook a warning dialog will appear to remind you of this risk configuring the transformation follow these steps to configure the transformation in block 1, on the first line, click the select a transformation drop down to choose a transformation type once the configuration is complete, click transform again to apply additional transformations if needed the next line in the block will be then you can select additional transformation actions to apply to the output of the previous transformation tip if you are fetching data from a json field using a record trigger or record search, remember that the result will appear as a string to transform this data as json, use the parse json transformation before performing any additional operations available transformations the transform data action provides a wide range of transformation functions organized by category the following transformations are available in the select a transformation drop down array transformations average calculate the average value of numeric array elements returns the mean of all numeric values in the array average by calculate the average value of a plucked property of objects within an array of objects uses a jsonata path to extract the property values before calculating the average count if count all items of an array that are equal to a specific value returns the number of matching elements count if by count all items of an array of objects that contain a plucked property equal to a specific value uses a jsonata path to access the property for comparison filter filter an array to the values that match a regular expression, a specific value, or non null value supports both exact matches and regex patterns filter by filter an array of objects to those that contain a property or deeply nested property whose values match a regular expression, a specific value, or non null value uses a jsonata path to access the property flatten flatten an array containing potentially nested arrays to a single array removes one level of nesting force array wrap a value in an array if it is not already an array ensures the output is always an array type get at get the item of an array at a specific index supports negative indices (e g , 1 for the last item) maximum find the maximum value in an array of numbers returns the largest numeric value maximum by find the maximum value of a plucked property of the objects within an array of objects uses a jsonata path to extract property values mean compute the mean of the values in an array of numbers calculates the arithmetic mean mean by compute the mean of the values plucked from objects within an array of objects uses a jsonata path to extract values minimum find the minimum value in an array of numbers returns the smallest numeric value minimum by find the minimum value of a plucked property of the objects within an array of objects uses a jsonata path to extract property values prepend get an array containing the value or array of values of the second input followed by the value or array of values of the first input combines arrays or prepends values remove duplicates remove duplicate items from an array returns a new array containing unique values only remove item remove all instances of an item from an array filters out all occurrences of the specified item slice get the subarray of items that exist between the specified starting and ending indices of an array extracts a range of elements sort sort the items of an array of strings or numbers by value supports ascending and descending order with locale aware comparison sort by sort the items of an array of objects by the value of a plucked property of the objects within the array uses a jsonata path to determine sort order sum sum the values of an array of numbers returns the total of all numeric values sum by sum the values of a plucked property of the objects within an array of objects uses a jsonata path to extract property values before summing date and time transformations adjust date / time adjust an iso 8601 date/time or a unix epoch by adding or subtracting a specified amount of time supports operations (adding/subtracting), amount, and units (milliseconds, seconds, minutes, hours, days, weeks, months, years) returns the adjusted timestamp in iso 8601 format append time zone append or overwrite the time zone or offset of an iso 8601 date/time without adjusting the underlying date/time useful for adding timezone information to dates that lack it convert date / time convert an iso 8601 date/time or a unix epoch to an iso 8601 date/time, custom formatted date/time, or a unix epoch supports output formats iso 8601, unix (seconds), unix (milliseconds), sql, or custom format string get date / time parse a date/time and convert it to an iso 8601 date/time can get the current time or parse a date/time from playbook data supports various input formats (iso 8601, unix, sql, custom) and timezone handling set time zone set the time zone or offset of an iso 8601 date/time, adjusting the underlying date/time accordingly converts the date/time to the specified timezone to iso date convert an iso 8601 date/time or a unix epoch to an iso 8601 date extracts only the date portion, discarding the time component to iso time convert an iso 8601 date/time or a unix epoch to an iso 8601 time extracts only the time portion, discarding the date component numeric transformations absolute value compute the absolute value of a number returns the non negative value of the input number adjust adjust a number by adding, subtracting, multiplying by, dividing by, or computing the modulo with another number supports basic arithmetic operations ceiling adjust a number by rounding it up (ceiling) rounds up to the nearest integer or specified precision floor adjust a number by rounding it down (flooring) rounds down to the nearest integer or specified precision greater than check if the first number is greater than the second returns a boolean value greater than or equal check if the first number is greater than or equal to the second returns a boolean value in range check if a number is between two values, non inclusive of the ending value determines if a value falls within a specified range less than check if the first number is less than the second returns a boolean value less than or equal check if the first number is less than or equal to the second returns a boolean value random generate a random number between inclusive lower and upper bounds can generate either floating point or integer values round adjust a number by rounding it rounds to the nearest integer or specified precision object transformations deep flatten deeply flatten an object converts nested object structures into a flat structure with dot notation keys deep merge deep merges two given objects combines objects recursively, with values from the second object taking precedence extract property extract the value of a property or deeply nested property of an object uses a jsonata property path to navigate through nested structures (e g , user profile email or $ data items\[0] name ) get keys list the keys of a given object returns an array containing all property names of the object get values list the property values of a given object returns an array containing all property values of the object is equal perform a deep comparison between two values to determine if they are equivalent returns true if values are deeply equal, false otherwise pick properties create an object composed of the picked properties selects specific properties from an object to create a new object remove property remove a property on an object supports nested property paths using dot notation returns a new object with the specified property removed stringify convert an object into stringified form converts the object to a json string representation string transformations base64 decode convert a string from base 64 representation decodes base64 encoded text with optional character encoding specification base64 encode convert a string to base 64 representation encodes text to base64 with optional character encoding specification (default utf 8) camel case convert a string to camel case transforms text to camelcase format (e g , "hello world" → "helloworld") capitalize convert the first character of a string to upper case and the remaining to lower case capitalizes only the first letter contains determine if a string contains at least one occurrence of a search term supports case sensitive and case insensitive matching returns a boolean value defang replace and/or surround certain characters in a string to render it unactionable (e g , non clickable) used for security purposes to prevent accidental execution of urls, ips, etc ends with check if a string ends with another returns true if the string ends with the target value evaluate expression parse and evaluate a string containing literal json or a jsonata expression allows you to execute complex jsonata expressions for advanced transformations hash compute the hash of a value supports multiple hash algorithms including md5, sha1, sha224, sha256, sha384, sha512, and sha3 variants returns the hashed value in hexadecimal format levenshtein distance find the edit/levenshtein distance between two strings calculates the minimum number of single character edits needed to transform one string into another match find occurrences of a search term in a string and returns an array of all indices where the search term is located supports case sensitive and case insensitive matching pad pad a string on the left and right sides if it's shorter than length padding characters are truncated if they can't be evenly divided by length pad end pad a string on the right side if it's shorter than length adds padding characters to the end of the string pad start pad a string on the left side if it's shorter than length adds padding characters to the beginning of the string parse json convert stringified json text to a json value parses a json string into a javascript object that can be used in subsequent transformations refang restore a defanged string to its original value to re render it actionable (e g , clickable) reverses the defang operation repeat repeat a string n times creates a new string by repeating the input string the specified number of times replace find occurrences of a search term in a string and replaces each occurrence with another string supports case sensitive and case insensitive replacement with global replacement by default split find occurrences of a delimiter in a string and splits the string into an array of substrings for each occurrence divides a string into an array based on the delimiter starts with check if a string starts with another returns true if the string begins with the target value strip remove all whitespace (tabs, spaces, and newlines) from both the left and right side of text spaces in between words will not be removed url decode convert url safe characters in a given string to url unsafe characters decodes url encoded strings (e g , "%20" → " ") url encode convert url unsafe characters in a given string to url safe characters encodes strings for use in urls (e g , " " → "%20") uuid v4 generate a v4 universally unique identifier (uuid) creates a random uuid following the uuid v4 specification regular expression transformations contains check if a string contains at least one occurrence of a regular expression pattern supports regex flags ('i' for ignore case, 'm' for multiline) returns a boolean value match find occurrences of a regular expression pattern in a string and returns an array of the matched strings can return either matches or capture groups, with optional limit on number of matches match one find the first occurrence of a regular expression pattern in a string and returns the matched string returns the first match or an empty string if no match is found replace find occurrences of a regular expression pattern in a string and replaces each occurrence with another string supports regex flags and optional limit on number of replacements split find occurrences of a regular expression pattern in a string and splits the string into an array of substrings for each occurrence uses regex pattern as delimiter with optional limit value transformations from csv parse a csv string converts csv text into an array of objects (if headers are included) or an array of arrays supports header detection from xml parse an xml string converts xml text into a javascript object using compact format from yaml parse a yaml string converts yaml text into a javascript object is array check if a value is an array returns true if the value is an array, false otherwise is blank determine if a value is an empty string, array, object or falsy returns true for empty values, null, undefined, empty strings, empty arrays, or empty objects is empty determine if a value is an empty string, array, or object similar to is blank but excludes boolean false from being considered empty is null or undefined check if a value is null or undefined returns true only for null or undefined values is object check if a value is an object returns true if the value is an object (but not an array), false otherwise is string check if a value is a string returns true if the value is a string type, false otherwise to csv serialize a value to csv converts an array of objects to csv format with headers to xml serialize a value to xml converts a javascript object to xml format using compact representation to yaml serialize a value to yaml converts a javascript object to yaml format examples example 1 extracting data from a json object scenario you receive data in json format and need to extract specific fields for further processing drag and drop the transform data action onto the playbook canvas configure the transformation to extract the desired data first if your data is a json string, select parse json from the transformation type drop down to convert it to a json object then select extract property and provide a jsonata path to navigate to the specific json fields (e g , $ user name or user email ) output the extracted data is ready for subsequent actions example 2 combining array values scenario combine multiple values from an array into a single string or combine two arrays drag and drop the transform data action configure the transformation first select prepend from the transformation type drop down to combine arrays or values then provide the values or arrays you want to combine alternative for string concatenation, you can use evaluate expression with a jsonata expression like $join(\[first name, last name], " ") to combine strings with a separator output combined values or arrays ready for use example 3 converting date formats scenario convert a date from one format to another (e g , from unix timestamp to iso 8601, or from custom format to iso 8601) add the transform data action to the playbook configure the transformation first select get date / time from the transformation type drop down to parse the date from your data source then select convert date / time and specify the output format (e g , iso 8601, unix seconds, unix milliseconds, sql, or custom format) output the date converted to the desired format example 4 filtering array elements scenario filter an array to include only items that meet specific criteria (e g , users older than 18, or strings containing a specific pattern) use the transform data action configure the transformation first select filter from the transformation type drop down to filter by value or regular expression then provide the filter value or pattern for filtering objects by property values, use filter by and specify the jsonata path to the property (e g , age ) and the filter value (e g , 18 ) output an array containing only items that match the filter criteria example 5 parsing json strings scenario you have a json string from a record trigger or record search that needs to be parsed into a json object for further transformation drag and drop the transform data action configure the transformation first select parse json from the transformation type drop down to convert the json string to a json object then apply additional transformations as needed (e g , extract properties, filter, etc ) output the json string is converted to a json object that can be used in subsequent transformations example 6 adjusting date/time values scenario add or subtract time from a date (e g , add 5 days, subtract 2 hours) drag and drop the transform data action configure the transformation first select get date / time from the transformation type drop down if starting from a data source, or use an existing date value then select adjust date / time and specify operation adding or subtracting amount the number of time units unit milliseconds, seconds, minutes, hours, days, weeks, months, or years output the adjusted date/time in iso 8601 format best practices start simple begin with basic transformations and progressively add complexity as needed test transformations test each transformation step to ensure accuracy before applying subsequent actions keep track of changes document the purpose and expected outcome of each transformation block for easier maintenance avoid overcomplicating use clear and straightforward transformations to ensure maintainability use parse json first when working with json strings from record triggers or searches, always use parse json as the first transformation before extracting properties or performing other operations chain transformations leverage the then functionality to chain multiple transformations together, building complex transformations from simple operations use cases for more practical applications, explore the docid\ heu0qvyfqkxi5scqvhp49