4

Documentation for Guide template language has an example of how to call a function, but nothing on how to define a new function. Any advice on this?

Tried:

Defining in a server-side JS block

    <script runat="server">
        var Something = function(){
            return "FOO!";
        }
    </script>
    <p>{{=Something()}}</p>

But breaks the page. If you have to ask for error codes, you haven't worked with this tool yet: the error reporting is even more useless than the documentation.

2

Guide Template Language is able to use AMPscript functions using simple tags and the = prefix. Guide will pass any parameters included in the inner text of the template to the specified function. Once completed, Guide replaces the template with the output of the function.

Currently Guide does not support user created functions like Handlebars.js does natively.

List of AMPscript functions that should be available within the Guide and follows the same parameters for usage.

Basic structure:

{{=function(parameter)}}

Example:

{{=Add(1,1)}} 

Displays the result of 2.

You must quote string and date literals. You can optionally quote numeric literals. You can include an ampersand (&) character or enclose the variable with single curly brackets ({}) to render the content as un-escaped within the function. Guide treats any string prefixed with an & character as a variable.

0

I have used the above structure in task activity of Journey Builder to basically send a SMS using Salesforce data. But the curly braces are replaced by quotes and sends the SMS like this

""=Uppercase(Event."SalesforceObj8e3ec1484b"."Contact:FirstName")"", message here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.