Questions tagged [gtl]

SFMC Guide Template Language is an email scripting supplement to AMPScript and Server-Side JavaScript.

Filter by
Sorted by
Tagged with
21
votes
4answers
11k views

Can AMPScript parse JSON?

Using AMPScript to parse an XML feed. Client is switching to JSON. Is there something similar to BuildrowsetfromXML() for JSON in AMPScript? I am confined to using the members login area and not an ...
9
votes
1answer
389 views

How to express the last iteration of #each in Guide Template Language?

I am trying to use json arrays in my email using Guide template language and the issue is I need to stop showing the divider line on the last iteration of {{#each}} loop. I have tried {{@last}} or any ...
6
votes
1answer
1k views

How does Guide Template Language parse a straight JSON array?

I'm learning Guide, and I've been able to parse an array of objects... AmpScript: set @json = '[{"voucher":"123456789"}, {"voucher":"234567890"}]' Guide: {{.dataobject JsonVar type=variable ...
4
votes
2answers
1k views

Define a function in Guide Template Language

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 &...
4
votes
2answers
1k views

Looping through json in email - impossible?

This nested Guide Template Language snippet brings me 6 rows of titles. Problem: I have a complex layout in an email and I want to populate it with titles in different places. I can not make a ...
3
votes
0answers
119 views

Un-Escaped HTML for Variables in Guide Template Language Not Working

We have HTML templates in ExactTarget that use variables passed in via the REST API. The variable contains text with HTML entities. I read the following documentation for the Guide Template Language....
2
votes
1answer
1k views

Guide Template Language to provide dynamic links via href attribute from JSON

I'm using GTL to parse a JSON attribute coming from a Data Extension. Everything works fine except links in href attribute. For some reason/limitation they don't render in the href attribute. I was ...
2
votes
2answers
361 views

First “0” is missing when displaying a number starting with “0”, with GTL

I need to display numeric value in transnational email. I'm parsing json with GTL. Some times the payload can have a value like 012345, but in the email the display is 12345. I tried to format with ...
2
votes
1answer
145 views

Using GTL for Nested JSON in Marketing Cloud Email HTML

Working on parsing some JSON in the HTML of a Marketing Cloud email using GTL and AMPscript and I've figured out how to do one degree of nesting, but can't figure out how to dig down deeper than that. ...
2
votes
1answer
190 views

GTL in a HTML Email

I am using Guide Template Language (GTL) in a HTML email to output data in a table format. The table alignment is off when displaying data from the attributes. I notice that an extra blank column ...
2
votes
2answers
748 views

AMPScript/GTL function to check if variable is string or a numeric

Need to check a type of variable in ampscript, in order to use FormatNumber function(that can only work with integer variables). I tried the Handlebars function {{isString()}}, but can't make it ...
2
votes
1answer
645 views

How to access sub item in json using Guide template language in this code?

I am using Guide template language to pull content from a remote url. This works but takes the title from too high up in json structure: {{.dataobject JsonVar type=variable source=@json maxrows=3}} {...
2
votes
0answers
625 views

Set GTL output in AMPSCRIPT variables

hope that someone can help me here: I'm trying to retrieve a simple result from a POST api call into ampscript variables. The cloudpage does show the variables as GTL, but when I try to display them ...
2
votes
0answers
178 views

GTL Json data looping

I have a GTL code that loops through my JSON code. In the JSON string i have several order data but in each array there is the same adress information like so: [{ "name":"This is a name", "sku":"8547"...
2
votes
1answer
779 views

Using GTL to Display Data from Nested JSON Arrays

I am building an email using data passed through JSON. Here is an example of the JSON file: { "order": { "items": [ { *Other Data*, "tracking": [ { **"...
2
votes
0answers
392 views

Ampscript Loop : Multiple rows needed in multi-column email layout

My newsletter was set up to loop per row in the DE to fill in needed info into a content block that gets created up to 35 times. There has been a new content block that now requires I pull two or more ...
2
votes
1answer
351 views

GTL in a Content Area

I'm using GTL (Guide Template Language) on the body of an email where I want to show some images dynamically and works well. But, to let the email more "clean" I want to copy that GTL code on a ...
1
vote
3answers
1k views

Guide Template Language blocks displayed in CloudPages

I can't figure out how to get GTL working on CloudPages. I was informed that it should work. Here's my HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"&...
1
vote
1answer
490 views

GTL in cloudpages: #with

If I have this json: { "name":"Tania", "invoice":{ "city":"BCN", "zip_code":"1005", "amount":"56.13", "datetime":"05/09/2017", "address":"Calle", "name":"...
1
vote
3answers
1k views

Guide Template Language to provide dynamic links via href attribute

I'm trying to use the Guide Template Language to provide a dynamic link in a triggered send, something like this: <a href="{{My_Url}}">{{My Url}}</a> or <a href="{{My_Url}}">Your ...
1
vote
2answers
2k views

How to access nested JSON (sub-objects) in data

I'm using the dataobject tag to parse JSON that is in a variable as described by: https://help.exacttarget.com/en-US/documentation/guide_template_language/parsing_json/dataobject_tag_examples/ How ...
1
vote
2answers
692 views

GTL Basic Personalization example

I'm new in using GTL, I want to know if someone has an example of a GTL Basic Personalization. I have this JSON :{ “First Name” : “Angela”, “Last Name” : “Cruz”, “City” : “Chicago”} and this html: &...
1
vote
1answer
444 views

Unable to parse JSON using Guide Template Language

I have a Json Input string , while parsing the Json the Description field value is breaking into another line, why this line is breaking %%[ var @Json set @Json = '{ "ArticleCount": ...
1
vote
1answer
392 views

Cannot set data type for variables in Guide Template language

According to the documentation you should be able to set the data type of a variable using a kind parameter: N - number C - currency D - date For example: {{example [kind=N]}} or {{example [k=N]}...
1
vote
2answers
89 views

Comparing records from Data extension

I have a weird situation, I need to check a value in an Data Extension and if the value is not there, I need to update another data extension. But if the value is there, the data extension should not ...
1
vote
1answer
190 views

Using Journey Context data in email

Is there any way to retrieve a Journey's context data (definitionInstanceId, journeyId) using AMPscript, GTL or SSJS in an email ?
1
vote
1answer
817 views

Can the guide template language be used with content in a microsite?

Can the guide template language be used with content in a microsite? If it can then please describe change required to following to allow it to display same as email content. <script runat=server&...
1
vote
0answers
84 views

GTL comparisons

I have the following GTL code wich workes fine: {{#if Months!=""}}{{Months}}{{/if}} However i want to do a double check. So i want to check if the field weeks is empty or greater than 1. I tried ...
1
vote
0answers
178 views

GTL conditional display of JSON content based on later values

EDIT: It occurred to me that there is a much simpler, broader way of asking this (or at least very relevant to it): is there a way to pull unique values from a JSON attribute, e.g. within the ....
1
vote
0answers
170 views

GTL - Can't use inside a content block?

I created a code snippet that contains AMPscript and GTL: %%[ /*API Subscriber Config*/ ContentBlockByName("Content Builder\_EmailAssets\Code Snippets\API Subscriptions\API Subscriber Config") SET @...
1
vote
0answers
105 views

Journey Data in Mobile Push

I am trying to personalize a Push message with Journey Data coming from API call. I am trying to use GTL but it is not working. {{Event.Event-Definition-Key.Attribute-name}} Thanks!
1
vote
1answer
341 views

GTL : Journey Data and Contact Data inside Journey Builder Email activity

I want to use GTL with Journey Data and Contact Data to personalize an Email with information stored in Contact Builder and information coming from an API event triggered by an external system. I am ...
0
votes
1answer
144 views

Idea: Improve dynamic content blocks (VAWP-related)

Salesforce support told me i should create a case on stackexchange to get votes on this idea because they admitted it is an gap in product. Here is a link to the problem: Dynamic Content blocks inside ...
0
votes
1answer
108 views

Continuous Pull in Ampscript, GTL, or SSJS from a JSON file

I am trying to find the best method in a Marketing Cloud email to continuously pull data from a JSON file that updates every 5 seconds so that it is "Live" Data within the email. Currently I ...
0
votes
1answer
132 views

Parse nested JSON using GTL in CloudPage

I am trying to parse a nested JSON in CloudPage using GTL. I have reviewed the comments from other cases on this topic but unable to figure out the issue. Can someone review it and let me know if I am ...
0
votes
1answer
948 views

Can you parse custom JSON data using GTL/AmpScript? [closed]

I am trying to send out personalized emails using GTL and AmpScript but i was wondering if you can pass custom data in the form of a JSON object within a data extension For example if a Data extension ...
0
votes
2answers
2k views

Json parse in emails with ampscript

Im trying to parse some weather json data in my email. But I cant quite fiqure out the syntax. With this code I'm trying to get the main.temp value printed. Below is my code so far, but it dosnt work :...
0
votes
2answers
61 views

Parsing through JSON

I have submitted a Json string to a data extension under the field name of "products" and can see the data within Marketing Cloud: Example data: [{"name": "Lunch1", "...
0
votes
1answer
315 views

Can't get GTL to loop through a JSON array of strings without keys (unordered)

I've been having a lot of success parsing JSON with GTL for emails, but there's something that I just cannot get to work. Given the following JSON { "category1": "something", "category2": "...
0
votes
1answer
129 views

How display the cities array info?

Set @record_search = '{"age":42,"cities":["Cobbtown, GA","Metter, GA"]}' {{.datasource JSONVar type=variable source=@json maxRows = 20}} {{.data}} { "target" : "@record_search" } {{/data}} %%[ for @...
0
votes
1answer
753 views

GTL and multi nested JSON

I need to send an email and update a data extension based on JSON content. I've written code combining GTL and AMPscript but I keep getting errors. And also since this is my first time using GTL and ...
0
votes
1answer
445 views

Using Guided Template langauge with Ampscript

I am using GTL with Ampscript to personalise an SMS by creating the task activity in Journey Builder which then talks to Salesforce data and triggers a SMS. I have used the description field to insert ...
0
votes
1answer
189 views

Unexpected behavior when using multiple datasource blocks in Guide Template Language

As per the GTL documentation you open up the datasource to start using it, then close it off at the end of the content: {{.datasource datasourceName [type=<datasourcetype>] [maxRows=<int>]...
0
votes
1answer
473 views

Mustache tag containing space characters are not displayed in Guide Template Language

I'm having issues with space characters in JSON object names. GTL does not find the names in a JSON object if the name contains spaces. I have a "Shipping Address" JSON object that looks like this (...
0
votes
2answers
4k views

Parse JSON string in AMPscript

We are currently passing a string attribute via the REST API that contains JSON. { "User_List": "[{\"name\":\"john doe\", \"email\":\"john.doe@mail.com\"}, {\"name\":\"jane doe\", \"email\":\"jane....
0
votes
1answer
118 views

using AMPscript variable instead of the target Data Extension's name in Guide Template Language dataobject type list

I am building an email in Content Builder that will show GTL variables but I want to set an AMPscript variable to the target Data Extension’s name. I find that I can use AMPscript variables in the GTL ...
0
votes
1answer
165 views

GTL counting Json string

I have set up a GTL and AMP script that looks at my attributes where i passed in a Json string (array). This is the string: `[{"MiddleName":"der","LastName":"Test"},{"MiddleName":"van der","LastName"...
0
votes
0answers
104 views

Content pulled from JSON becomes ASCII encoded when special character

I am successfully pulling content from a JSON feed into an email using set @json = TreatAsContent(HttpGET("https://test.com/fakeaddress")) The feed contains a lot of special characters (åäöé) and ...
0
votes
1answer
1k views

Cannot store JSON object in Data Extension

We are storing a JSON object in a Data Extension field, then using GTL to parse the JSON and retrieve nested values in the object. It's working really well. However, the challenge is to get the JSON ...