Automation Action: Set Variable
Assign a value to a variable with various Set Operations.
Create or set a ThinkAutomation variable.
In addition to Extracted Fields you can also make use of Variables in your ThinkAutomation Actions.
A variable is simply a place holder for a specific value.
Many other Actions can return values which can be assigned to variables. In these cases you should create the variable first by simply dragging into the Actions list and giving it a name before using it other Actions.
Each variable must be given a Variable Name. Enter a new variable name to set its initial value, or choose an existing variable or extracted field to change its current value.
You can optionally assign it a Value. The value can be a fixed value or the value of another variable, extracted field or combination (using %variable% replacements).
The variable value can then be used on any other Automation action setting using %variablename% replacement (see: Variable Replacements).
Set Variable Operations
The Operation option allows you to perform an optional additional operation on the Value before it's assigned to the variable. The following operations are available:
Category | Details |
---|---|
No Operation | Just Assign |
Case | To Lower Case |
Case | To Upper Case |
Case | To Word Capitalized |
Convert | HTML To Plain Text (see: HTML Parsing Notes) |
Convert | HTML To XML (converts HTML to well-formed XML) (see: HTML Parsing Notes) |
Convert | HTML To JSON |
Convert | HTML To Markdown |
Convert | JSON To HTML (converts Json text into a formatted HTML table) |
Convert | JSON To CSV (converts Json or Json Array into CSV text) |
Convert | JSON To XML |
Convert | HTML CSS To Inline Style Attributes |
Convert | Markdown To HTML (see: Markdown Notes) |
Convert | CSV To HTML Table |
Convert | CSV To JSON Array |
Convert | CSV To Markdown Table |
Convert | Plain Text To HTML |
Convert | Reformat Json (reformat, tidy & reindent Json text). (see: Json Notes) |
Convert | XML To JSON |
Date | Add Days To (if the existing value is a date then adds the days specified in the value to the existing date) |
Date | Subtract Days From (if the existing value is a date then subtracts the days specified in the value ) |
Date | Day Number Only (if the existing value is a datetime then returns the day part) |
Date | Day Of Week Name Only (if the existing value is a datetime then returns the day name, 'Mon,Tues' etc) |
Date | Day Of Week Number Only (0=Sunday, 1=Monday etc) |
Date | Hours Only (if the existing value is a datetime then returns the hours part) |
Date | Minutes Only (f the existing value is a datetime then returns the minutes part) |
Date | Month Name Only (if the existing value is a datetime then returns the month name) |
Date | Month Number Only (if the existing value is a datetime then returns the month number) |
Date | Seconds Only (if the existing value is a datetime then returns the seconds part) |
Date | Time Only (if the existing value is a datetime then returns the time part only in hh:mm:ss format) |
Date | Week Number Only (if the existing value is a datetime then returns the ISO8601 week number) |
Date | Year Only (if the existing value is a datetime then returns the year number) |
Extract | Alias From Email Address (eg: 'test' from 'test@mydomain.com') |
Extract | Name From Email Address (eg: 'Test Name' from "Test Name" <test@mydomain.com>) |
Extract | Domain From Email Address (eg: 'mydomain.com' from 'test@mydomain.com') |
Extract | All Email Addresses (returns comma separated list) |
Extract | All URLs (returns comma separated list) |
Extract | Concepts |
Extract | Directory Name Only From Path & Filename (eg: 'C:\Documents' from 'C:\Documents\mydocument.pdf') |
Extract | Filename Only From Path & Filename (eg: 'mydocument.pdf' from 'C:\Documents\mydocument.pdf') |
Extract | File Extension From Filename (eg 'pdf' from 'mydocument.pdf') |
Extract | Filename Without Extension (eg 'mydocument' from 'mydocument.pdf') |
Extract | First Email Address Only |
Extract | First Line |
Extract | First Phone Number (finds and extracts the first valid phone number in any text) |
Extract | First Sentence |
Extract | First URL |
Extract | First Word |
Extract | Last Word |
Extract | Header Value (extracts a header value from the incoming message headers - set the value to the header name) |
Extract | Keywords (returns comma separated list of words with common words removed) |
Extract | Summarized Text |
Mask | Mask Credit Card Numbers (replaces any credit card numbers with ***) |
Mask | Mask Profanities (replaces any profanity words with ***) |
Numeric | Add To (adds the value specified to the current value of the variable) |
Numeric | Decrement (subtracts 1 from the current value of the variable) |
Numeric | Get Length |
Numeric | Get Word Count |
Numeric | Get Lines Count (excluding blank lines) |
Numeric | Get Numeric Value (converts text containing a number to the number only) |
Numeric | Increment (adds 1 to the current value of the variable) |
Numeric | Subtract From (subtracts the value specified from current value of the variable) |
Numeric | Hex Convert Decimal To Hex |
Numeric | Hex Convert Hex To Decimal |
String | Add Space Character To End |
Create | Global Unique Identifier (Guid - In hex or decimal format) |
Create | ObjectId (MongoDB style unique string) |
String | Normalize Whitespace (normalizes unicode word and line separators to standard space and line feed characters) |
String | Normalize Line Endings (Cr+Lf) |
String | Normalize Line Endings (LF Only) |
String | Normalize Words (normalizes common English contractions (eg: 'what's' to 'what is') and common abbreviations (eg: hi to hello, Nov to November, ur to your, bday to birthday, 2day to today, plz to please, thx to thanks etc.)) |
String | Prepend |
String | Remove All Whitespace (all spaces and control characters are removed) |
String | Remove Invalid Filename Characters |
String | Sort Lines Ascending |
String | Sort Lines Descending |
String | Dedup Lines (removes duplicate lines, case insensitive ) |
Transform | Base 64 Decode |
Transform | Base 64 Encode |
Transform | Compress (compresses the value to Base64 encoded text) |
Transform | Create MD5 Hash (Hex Encoded) |
Transform | Create MD5 Hash (URL Encoded) |
Transform | Decompress (decompresses the Base64 encoded value) |
Transform | Decrypt (decrypts the Base64 encoded value) |
Transform | Encrypt (encrypts the value to Base64 encoded text) |
Transform | HTML Entity Decode |
Transform | HTML Entity Encode |
Transform | Quoted Printable Decode |
Transform | Quoted Printable Encode |
Transform | SHA256 Hash (Base64 Encoded) |
Transform | SHA256 Hash (Url Encoded) |
Transform | SHA512 Hash (Base64 Encoded) |
Transform | SHA512 Hash (Url Encoded) |
Transform | URL Decode |
Transform | URL Encode |
Transform | JSON Escape (escapes json reserved characters) |
Trim | Trim (removes all whitespace, tab, CR and LF characters from the beginning and end of the text only) |
Trim | All Whitespace (replaces all whitespace, tab, CR, and LF characters with space characters, and removes extra space's so there are no occurrences of more than one space in a row) |
Trim | Blanks (replaces all whitespace, tab, CR and LF characters with spaces characters and trims) |
Trim | First And Last Characters (removes the first and last character) |
Trim | Blank Lines (All) (removes all blank lines in the text) |
Trim | Blank Lines (Repeating Only) (removes repeated blank lines, so the text only contains single blank lines) |
If the Append To Existing Value option is enabled then the Value will be appended to the existing value for the variable. Care should be taken using this if the Persist Value option is enabled and the variable value is not cleared at some point within the Automation, to avoid ending up with very large strings.
Solution Global Variables
By default variables are private to the Automation and the currently executing message instance. If the Solution Global option is enabled then the variable instance and current value is global to the Solution. This is useful if you have an Automation that uses the Call Automation action to call another Automation within the same solution. The global variables will be accessible and updatable in the called automation.
You should not use Global variables if you have enabled Concurrent Execution for the Automation. This is because the global variable values may change during Automation execution if multiple messages are executing concurrently. Concurrent execution is disabled by default for new Automations.
Persisted Variables
By default, when an Automation starts processing a message all Automation variables will be reset. If the Persist Value option is enabled then the variable value will be saved by the ThinkAutomation Server between messages processed. For example: If an Automation sets a persisted variable called 'var1' to 'abc' on message 1, when the Automation next executes for message 2 then variable 'var1' will be automatically set to 'abc' before the Automation starts processing. Persisted variables are stored in the Message Store database - so will be persisted even when the ThinkAutomation Server is restarted. Variables will only be persisted if the default value for the variable (the value assigned to it on the first Set action within the Automation) is blank.