You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64-2Lines changed: 64 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ Using XTL provides the following benefits:
80
80
81
81
## Types
82
82
Native Types:
83
-
- String Constants (Alpha numeric text inside quotes)
83
+
- String Constants (Alpha numeric text inside double quotes or single quotes)
84
84
- Integers (Digit expression)
85
85
- Doubles (Digits are separated by '.', a 'd' is appended to separate from decimals. E.g: 1.4d)
86
86
- Decimals (Digits are separated by '.', a 'm' is appended to separate from doubles. E.g: 1.4m)
@@ -343,7 +343,7 @@ Above example could return something like 'Baggins, Frodo'.
343
343
Takes the substring of your input starting from a given index. Length of substring can be passed optionally as well.
344
344
345
345
Example:
346
-
```
346
+
```JavaScript
347
347
Substring(Value("firstname"), 1, 2 )
348
348
```
349
349
Above example returns 'ro' when input is 'Frodo'.
@@ -445,6 +445,68 @@ Format( Value("index"), { format: "{0:00000}" } ) // Will print 00001 for index
445
445
446
446
Refer to the .NET style for date formatting.
447
447
448
+
### Snippet
449
+
> Snippets are available in XTL >= v3.7
450
+
451
+
Snippets are an easy way for storing texts globally, so that they can be referred to from anywhere in the system.
452
+
They are stored in the XTL Snippet entity. You can use them as simple storage for a single (long) XTL expression, or even pass a complete text with embedded XTL expressions in the usual fashion (${{expression}}) inside it.
453
+
When only saving a XTL expression, be sure to set "Contains Plain text" to "No", so that XTL will automatically wrap your expression in ${{ ... }} brackets.
454
+
When saving a complete text with embedded XTL expressions, set "Contains Plain Text" to "Yes", so that XTL will do no automatic wrapping.
455
+
456
+
You can use the unique name inside the XTL snippet record for referring to it, or you can use the normal name and refer to it using its name and a custom fetchXml filter.
457
+
The second parameter is especially useful, as you can create custom fields on the snippet entity, for example a language field, and use the filter for fetching the correct language dynamically.
458
+
459
+
For the following examples, lets define some XTL snippets that we can imagine to be existent in our organization:
460
+
461
+
Snippet 1 (used for fetching the owner's name on any entity)
462
+
- oss_uniquename: "OwnerName"
463
+
- oss_containsplaintext: false
464
+
- oss_xtlexpression: Value("ownerid.name")
465
+
> Remember: We must not wrap the expression in the usual ${{...}} brackets in this case, this will be done automatically, when "Contains Plain Text" is false
466
+
467
+
Snippet 2 (used for generating a contact's salutation)
When running this on a contact with "new_languageisocode" equal to "EN", this will resolve to snippet name "Salutation_EN" and snippet 2 will thus be found.
493
+
494
+
#### Example - Refer to snippet with simple filter
495
+
Refers to Snippet 3, which will be matched by the following expression:
Before using the custom filter, all XTL tokens will be processed, so for a contact with "new_languageisocode" equal to "EN", the expression inside the filter value would be exchanged for "EN" and the correct snippet found and applied.
0 commit comments