$D.eval() or $D.getValueFromTemplate() Getting the field value of the current object
$D.getValueFromTemplate=function(fieldName[string])// the same but shorter:$D.eval = function(fieldName[string])// examples var name =$D.getValueFromTemplate("{{name}}") // name == Ivan// you also can get values from linked objects var phone =$D.getValueFromTemplate("{{author_id.phone}}") // phone == 79141230000// tip: for getting data from arrayLinks use $D.store.get()
$D.store.get() Getting an object from a different structure
$D.store.get=function(structName[string], objectID[string], fields[object])// example var object =$D.store.get("WebUser","7967", {fields: ["phone","role"]});// object == { role: "candidate,admin", phone: "79670190000", id: "7967" }
$D.store.save() Saving an object
$D.store.save=function(structName[string], obj[object], createEvent[boolean])// examplevarID="10341"$D.store.save("WebUser", {"id":ID,"stringF":"Changed string value" },true)// note that if createEvent == false, no event will be created, // so the scenarios will not trigger
This function resizes images and saves the result to the File storage
$D.image.resize(fileUrl[string], params) =function(string)//params is a json object like {"width": 100}, {"scale": .3}, or {"height": 130}var resizedImageUrl =$D.image.resize("https://booble.com/files/logo.png", {"width":100})
$D.concat() Adding an element into array while avoiding duplication
$D.concat=function(string, string)// arrays in Directual are strings, comma separated$D.concat('{{array}}','new element')// or$D.concat('{{array}}','{{other_field}}')// even or$D.concat('{{array}}','{{other_field_1}},{{other_field_2}}')//// e.g.// $D.concat('', '3') returns 3// $D.concat('1,2', '1,2,3') returns 1,2,3// $D.concat('1,2,3', '3,4') returns 1,2,3,4// $D.concat('1,2,3', '3') returns 1,2,3
$D.splice() Removing elements from an array
$D.splice=function(string, string)// arrays in Directual are strings, comma separated$D.splice('{{array}}','removed element')// or$D.splice('{{array}}','{{other_field}}')// even or$D.splice('{{array}}','{{other_field_1}},{{other_field_2}}')//// e.g.// $D.splice('', '3') returns ''// $D.splice('1,2', '1,2,3') returns 3// $D.splice('1,2,3', '3,4') returns 1,2// $D.splice('1,2,3', '3') returns 1,2
$D.json.fromXML("{{xml}}")// often there is a need to use the following templating features:$D.json.fromXML("{{#escape}}{{#stripNewLine}}{{xml}}{{/stripNewLine}}{{/escape}}")
JWT Methods
Encode
If the 'expiration' (exp field) is undefined, set the current timestamp in seconds based on UTC time.