Questions tagged [ampscript]

AMPscript is a proprietary scripting language for Salesforce Marketing Cloud products that you can embed within HTML emails, text emails, landing pages and SMS messages to control the content that is displayed to the individual consumer. It also provides functionality to track impressions and highlight which content areas get the most attention from the viewer.

Filter by
Sorted by
Tagged with
21
votes
4answers
10k 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 ...
12
votes
3answers
4k views

How to use HTTPGet variable in URL (ExactTarget)?

Been trying to figure out a way to pass in the variable into a HTTPGet function for long time now. How to do it? Here's what I have so far, but it doesn't return anything. <p id="date" style="...
12
votes
5answers
4k views

Using AMPscript to retrieve content from CloudPages

We've build a CloudPage that looks like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body>hello world</body&...
10
votes
1answer
264 views

What are the extra arguments in InvokePerform() AMPScript function?

There are no examples on the usage of the InvokePerform() AMPScript function in the official documentation -- at least that I can find. Doing some testing and comparing the usage to the SOAP API, I ...
9
votes
4answers
2k views

How to get the floor (round down instead of up) of a number with AMPscript?

I'm doing a bit of math with AMPscript, and I'd like to be able to round a number DOWN eg: I would like 5.5, 5.6, 5.7 etc.. to become 5, not 6 The standard FormatNumber() function will automatically ...
9
votes
1answer
597 views

Using AMPscript/SSJS how do you unsubscribe a subscriber from a child business unit?

My goal is to create a page that passes a business unit id and a subscriber key. The page sits on the parent/enterprise business unit, it will receive business unit ids from a child business unit. ...
9
votes
1answer
683 views

Handing REST API POST Exceptions using SSJS Try-Catch on a Landing Page Form Submission with AMPSCRIPT

I have an issue with a landing page containing a webform that submits input from the user and using AMPSCRIPT I make a Rest API call using the HTTPPost2 function to utilize the validateEmail resource. ...
7
votes
2answers
1k views

How to determine if a number is even or odd with AMPScript?

I have a global variable called @Count. I also have a for loop that increases the @Count by 1 each time I cycle through the loop. Is there a way for me to detect with AMPScript whether @Count is an ...
7
votes
4answers
206 views

Scalable Journeys in Marketing cloud with different templates

Is there any scalable way of designing a journey in Marketing Cloud which: Sends a different email (the template) depending on the current data data? i.e. a contact picklist value with 25 possible ...
7
votes
1answer
1k views

Why does ExactTarget not find a subscriber in job when creating a custom unsubscribe for Salesforce integration?

I have a custom preference center for a client with an ExactTarget account integrated with Salesforce. I have tried a couple of methods for unsubscribing a record through ampscript including the one ...
7
votes
0answers
288 views

Use-cases for the WAT and WATP AMPScript functions

Do any of you fine folks know anything about the WAT() and WATP() AMPScript functions? I'm looking for a real use-case outside of the official documentation: Returns the values of the Web ...
6
votes
2answers
10k views

Dynamic sender profile with AmpScript

My Client is sending to 40 different countries a unique, localized and highly personalized email. They want to have a different sender profile depending on the contact country code, including a ...
6
votes
2answers
8k views

How To Display Values from a Data Extension with AMPScript

OK. So I have read all of the documentation, and tried this on my own, but this is all still coming up Japanese to me. I need help writing the code I need to bring data in from an extension to create ...
6
votes
1answer
194 views

Clarification - AttributeValue with CloudPagesURL

So... let's come to a topic i do not seem to fully understand: The function AttributeValue, especially in combination with the cloudpagesurl function. I will present three scenarios, two are working ...
6
votes
1answer
4k views

AmpScript to select Right or Left characters from a string

Is there an AmpScript function that can be used in an equivalent manner to sql left, right and mid functions? Thanks, Mark
6
votes
1answer
824 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 ...
6
votes
2answers
2k views

Retrieve subscriber status from a business unit with ampscript

I want to get the business unit level subscriber status of a subscriber from a landing page within that business unit. My first thought was a retrieve request on the subscriber by subscriber key but I ...
6
votes
2answers
358 views

Is there a way to identify all the places a Content Block is used?

I'm trying to identify all the places a Content Block is used. The goal is to be able to reference what will be affected if a Content Block is modified. I've looked a the Asset in the REST API, but I ...
5
votes
2answers
3k views

Difference between Amp script or ssjs

what is the main difference between amp script or ssjs in marketing cloud. Can you please give me clear information for amp script or ssjs difference.
5
votes
1answer
236 views

Marketing Cloud - callout from CloudPage to MC API - where to store credentials

We are building a simple functionality on a CloudPage that will be making an API call to Marketing Clouds API. I was looking at documentation to find information on where we should store the Client Id ...
5
votes
1answer
210 views

claimrow() is claiming two rows for each subscriber when used in a journey

This one has me stumped. I have the following AMPScript in an email: %%[ var @em, @couponRow, @couponCode if _messagecontext == "PREVIEW" then set @couponCode = "XX TEST XX" else set @...
5
votes
3answers
2k views

How can one retreive the business unit level subscription status from within the business unit?

I'm building an Ampscript-based preference center in a microsite inside a business unit on an enterprise 2 account. I can easily update my subscribers but I cannot seem to find a way to find the ...
5
votes
1answer
111 views

How to handle umlaute/mutations in AMP Script with REST API?

we are using AMPscript to transfer/send parts of our mailings we send through Email Studio (not Salesforce) to our REST service via HTTPPost to make the information available in an external CRM that ...
5
votes
1answer
4k views

View as Webpage custom setup for retrieval not working as expected

We recently added view as webpage URLs to our send logging data extension in order to show that url in another email. Article for reference: https://code.exacttarget.com/question/rebuild-view-web-...
5
votes
3answers
2k views

Decrypt a string encrypted by the EncryptSymmetric() AMPscript function using PHP

I read elsewhere in StackExchange that it's not possible to decrypt AES strings originating from AMPScript in PHP. Is this true? It seems that it should be possible with mcrypt. Also, part two for ...
5
votes
1answer
136 views

Why does UpsertDe fail with Subscriber ID?

I have an odd bug that I am running into. I will try to explain what we are seeing as best as possible without writing a novel! What we are trying to do is run a bit of AMPscript to add/update a ...
5
votes
1answer
501 views

AMPscript HTTPPost2 Parameters

I'm a bit lost with the HTTPPost2 function. According to the documentation, the fifth parameter is: used to contain string representation for the status of the HTTP request, such as OK. But this ...
5
votes
1answer
163 views

How to do an Unsub event on a shared publication list?

I am working on a landing page, and right now, the code is all done in AMPScript (as that's what I'm most comfortable with). I have a one-click unsub page that is working great, except for cases ...
5
votes
1answer
973 views

How to add Attributes to a TriggeredSendDefinition on LandingPage

I am creating a landing page with a form. On submit, the form passes variables to another landing page that will process and perform three different tasks, two of which are performing a TriggeredSend ...
5
votes
1answer
270 views

Using AMPscript/SSJS to unsubscribe from a parent business unit on a CloudPage from a child business unit?

If you click 'Unsubscribe from All' on the Subscriber in the Subscriber Properties modal in the parent business unit's context or when you perform an SSJS subscriber.Unsubscribe(); on a CloudPage on ...
5
votes
1answer
5k views

Print AMPscript Variable inside HTML <tag> as attributes

So I am using ExactTarget templates and content areas to build my emails. In my templates I have AMPscript variables defined in the < head > and that will determine how elements in my content areas ...
4
votes
2answers
5k views

Using AMPscript with SSJS Activities

I have tried using the below AMPscript block in an SSJS Activity, however it appears that Script activities only support SSJS and AMPscript cannot be included in Script Activities — please can someone ...
4
votes
2answers
15k views

Marketing Cloud Landing Page: pass values to a data extension

I created a landing page which auto-populates first name, last name and the email. Now I need to pass these 3 along with what radio buttons are selected by the user to a data extension other than the ...
4
votes
2answers
5k views

REST API Methods in AMPScript or SSJS

Is there any way via AMPScript or SSJS to utilize HTTP methods outside of GET and POST? I have had no problem utilizing these two via the HTTPPost() and HTTPGet() functions, but have not found any ...
4
votes
3answers
2k views

Loop Support in AMPscript

I'm very comfortable with using for loops in AMPscript. However, someone recently mentioned that other loop contexts are supported, similar to JavaScript, which offers: for - loops through a block of ...
4
votes
1answer
2k views

How to track URLs included in HTTPGet()

We are using AMPscript HTTPGet to pull in some HTML dynamically. The issue is that the URLs are not being wrapped in ET's tracking so clicks aren't being logged.
4
votes
3answers
4k views

Exact Target Data Extension and special characters - HTML markup

We have text fields and areas displayed within our Exact Target Landing Pages which had been inserted into a Data Extension text field using AMPscript enabled landing pages. We are using the "pre" tag ...
4
votes
1answer
4k views

AMPscript - If Contains

In an AMPscript If statement, is there a way to use "contains" as the operator? For example: If Var1 Contains "Dog" Then do this Would I just have to use a regular Expression? Thanks, Ben
4
votes
2answers
2k views

Can you 'break' a for loop in AmpScript?

I would like to know if its possible to break a FOR loop in AmpScript. I am traversing through a rowset and would like to stop on the first match. SET @BookingRowset = LookupOrderedRows("bookings", ...
4
votes
1answer
2k views

Difference between RequestParameter and QueryParameter

I'm retrieving a URL parameter from a CloudPage. What is the difference between RequestParameter() and QueryParameter()? They appear to do the same thing. Are there scenarios where you would need to ...
4
votes
1answer
450 views

How to use BuildRowSetFromXML with an “attribute-id” in SFMC?

I'm having trouble referencing a specific item in our order XML feed. I want to reference a specific "attribute-id", not the entire rowset. XML reference: <custom-attributes> <...
4
votes
2answers
747 views

UpdateSingleSalesforceObject - Error in the application

I am trying to save the send date in a Sales Cloud field with this expression: %%[SET @Lead_Id="00Q3100000Z3HIcAAN", SET @result = UpdateSingleSalesforceObject('Lead',@Lead_Id,'...
4
votes
1answer
541 views

how can we display only the timezone in AMPscript

how can we display only the timezone in AMPscript using now(). I tried using %%=Format(Now(),'zzzz')=%% but its not displaying the timeZone instead it's displaying -06:00.
4
votes
2answers
2k views

Any syntax checker for ampscript?

I've spent 30 minutes to debug a piece of code. Used $key instead of @key. How can I check the syntax? Any tools on SFMC?
4
votes
3answers
3k views

How do I fetch the Subscriber Key/ Contact Key using the AMPScript?

I am trying to create a personalized push notification and I need the Subscriber Key to do this. So my Solution has an 'interaction' type push message, a  journey that is triggered by a data ...
4
votes
2answers
2k views

RaiseError - Will it stop email from sending

I have an email that is pulling in a content area. In that content area it doing a lookup on a data extension. The data extension should have data for that subscriber in it but in some rare cases (...
4
votes
1answer
97 views

Formatting Date and TIME in French

I followed this question/Answer to format date in French: AMPscript Date Formating for French Language in HTML emails Following this post, I would like to know how we should add the time to the date ...
4
votes
1answer
859 views

How to resubscribe a subscriber in mobile connect

We have a use case where we want to house all unsubscribed in Salesforce CRM but not in Marketing Cloud. This works in email sends as I can always send the transactional emails from Marketing Cloud , ...
4
votes
1answer
599 views

Personalization Strings for Salesforce Campaigns

I'm sending an email to a Campaign from Content Builder. That is, I select Salesforce Audiences > Salesforce Campaigns > [campaign name] as the Audience when I send the email. This works fine, but I ...
4
votes
1answer
774 views

Using Exclusion Script with _Sent Data View

I would like to use an Exclusion Script when sending an email from Content Builder where if the Subscriber has received an email in the past week, then the email should be suppressed from sending. ...

1
2 3 4 5
48