Questions tagged [gtl]
SFMC Guide Template Language is an email scripting supplement to AMPScript and Server-Side JavaScript.
63
questions
0
votes
0
answers
22
views
In GTL datasource can I have conditional content appear based on the first instance only?
I'm using Amspscript and GTL datasource to extract information from a field in a data extension called: cancelled. This field has multiple items in there and within cancelled there is another field ...
0
votes
1
answer
160
views
Parsing JSON via GTL and AMPScript in marketing cloud
I need to create an automated email that will be triggered and sent to customer whenever a customer has requested to cancel a number of items within their order. I'm using both ampscript variables and ...
0
votes
0
answers
132
views
Not able to retrieve null values from nested JSON array using SSJS For loop
Here's the nested json I'm working with
{
"Instructions":{
"Instruction":[
{
"Type 1":"abc",
"Type 2":"...
0
votes
1
answer
300
views
Targeting a nested array with SSJS to use with a for in loop in Marketing Cloud
I've got some nested Json that's using a dictionary with dynamic keys and values - I don't know which key-value pairs will appear in the payload but I need to print them all in an email message.
The ...
-1
votes
1
answer
2k
views
How can I count the number of objects in my JSON
In the Marketing Cloud I have an attribute field. In this field a JSON is stored. Like so:
[{
"Example1": "XXXXX",
"Example2": "XXXXXX",
"...
0
votes
1
answer
176
views
Is it possible to create an elseif statement with GTL
I have created the following:
<script runat="server">
Platform.Load("Core","1");
var json = Attribute.GetValue('adressen');
var jsonObj = Platform.Function....
0
votes
1
answer
54
views
Building dynamic subjectlines with JSON
I have an email that can have multiple subject lines. This is based on the incoming data. For this, 1 content block is loaded containing all the different subject lines. The correct subject line is ...
0
votes
2
answers
322
views
Is there a way to parse JSON without names?
we have a simple JSON structure. This structure has no names like this:
["value1","value2"]
Is there a way to parse/use this in Marketing Cloud? We don't have to make decisions. ...
2
votes
1
answer
941
views
Storing JSON API payload in triggered send data extension field
I need to send an order confirmation email using the Transactional Messaging API. The email references the array of ordered items. Rather than store the ordered items as rows in another data extension ...
1
vote
1
answer
114
views
Filtering or Targeting Specific Node in JSON using GTL
I'm running into an issue where I have to parse through a JSON payload for an email using GTL, and I have issues trying to target a specific node in the payload.
If this were the example of the ...
2
votes
1
answer
659
views
Dynamic Alias from Data Extension breaks URL
We have a dynamically generated multi-language email which will take the country and language combination of a subscriberkey and fetch the content from a data extension, everything is working fine, ...
4
votes
1
answer
118
views
When using GTL in my mailings, I get a broken duplicate of the Mail after the real one
Nice to be here.
I try to create an email on the basis of GTL. I open an AMPScript variable, which contains many key value pairs in a flat JSON format. I do this at the start of the mail like this:
{{....
0
votes
1
answer
449
views
Use AMPScript variable to retrieve values from nested JSON in GTL
I am trying to pass a variable into a GTL datasource to get a set of nested values from a JSON so they can be used to dynamically theme an HTML module. In the below example I am able to get the values ...
2
votes
1
answer
913
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. ...
0
votes
2
answers
222
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
1
answer
438
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
1
answer
425
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
1
answer
969
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
1
answer
518
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 ...
2
votes
1
answer
608
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 ...
0
votes
1
answer
148
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 @...
2
votes
3
answers
2k
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
3
answers
1k
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 ...
1
vote
2
answers
188
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 ...
0
votes
1
answer
1k
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 ...
1
vote
2
answers
1k
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:
&...
2
votes
1
answer
1k
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 ...
1
vote
0
answers
155
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 ...
2
votes
0
answers
328
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"...
1
vote
0
answers
270
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 ....
2
votes
1
answer
2k
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": [
{
**"...
0
votes
1
answer
365
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"...
1
vote
0
answers
275
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
1
answer
374
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 ?
0
votes
1
answer
2k
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
2
answers
2k
views
Getting Error while try to get Salesforce OAuth access token from SFMC cloudpages ssjs httppost?
Actually I try to get access token of salesforce DC from salesforce MC by SSJS Httppost
I need to create a record in salesforce object From Salesforce marketing cloud pages
<!doctype html>
&...
0
votes
1
answer
213
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 ...
1
vote
0
answers
121
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!
2
votes
0
answers
656
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 ...
1
vote
1
answer
696
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
1
answer
511
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": ...
9
votes
1
answer
705
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 ...
2
votes
1
answer
433
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 ...
2
votes
1
answer
494
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
1
answer
562
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
0
answers
218
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 ...
2
votes
1
answer
823
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}}
{...
4
votes
3
answers
2k
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 ...
1
vote
3
answers
2k
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
1
answer
456
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]}...