New answers tagged ampscript
0
votes
Test send in Marketing Cloud does not send email
Pretty sure that files must exist at the root of the Import folder for the AttachFile() function to work.
Official docs are here.
Update
I'd suggest reviewing the NotSent tracking data. The Reason ...
- 29.3k
0
votes
Email Greeting in Journey Builder giving a Set Script error
Curly brackets won't work in AMPscript syntax.
I'd write it like this:
%%[
set @firstName = AttributeValue("FirstName")
set @LastName= AttributeValue("LastName")
IF NOT EMPTY(@...
- 29.3k
1
vote
Accepted
Struggling to debug AMPscript error
Try this:
%%[
var @rowcount, @rowcount2, @rowcountset
set @rowCount = DataExtensionRowCount("DE_1")
set @rowCount2 = DataExtensionRowCount("DE_2")
set @rowCountset = Add(@rowCount, ...
- 13.7k
0
votes
Troubleshooting simple IF/Then Ampscript Statemend SFMC (Dynamic Header)
Your lookup function is missing an argument. You can read this reference to know how to use it.
I don't know your DE construct, so I guess you can change something like this:
SET @PropertyName = ...
- 1,268
1
vote
Accepted
Pass querystring variable from one cloudpage to another
It seems you’re passing https://frefef.sfmc-content.com/xvk53leo4qh?%%=v(@lang)=%% which would resolve to eg. https://frefef.sfmc-content.com/xvk53leo4qh?fr
So try adding the actual qs part:
https://...
- 13.7k
1
vote
PrimaryKey Violation - how to display error message on cloudpage
Unfortunately, you cannot "convert" 500 Error to "Phone already exists" message. Since the InsertData function would be already executed and thus always throw an error when the ...
- 2,449
1
vote
PrimaryKey Violation - how to display error message on cloudpage
You have to use the [UpsertData] function instead of InsertData, you could add a timestamp field on your DE.
So in your case, it will be :
set @updatedDate = Now()
upsertData("unsubs"...
- 1,505
0
votes
SSJS - Creating HTML table from Lists pulled
the response from Gortonington look great, just one this if if (i = 1) should be if (i == 1)
and also
(i = allPublicationLists.length) should be (i == allPublicationLists.length)
because its doing ...
0
votes
Query to Segment data based on different Category
I think you should pivot the numbered categories and count how many of each there are -- then you can simplify your criteria:
CREATE TABLE categories (
[type] varchar(5)
, category1 varchar(...
- 29.3k
0
votes
XSLT error using TransformXML Function
I appreciate this is a very old item but here's a finding:
It works if you encode your XML and XSLT with Base64 method.
Create two content blocks of type Code Snippet in Content Builder.
One is for ...
-3
votes
Accepted
If condition for empty date field
You need to call ENDIF inside the ampscript block and needs to set some value after THEN condition.
Try like this
%%[
IF NOT EMPTY(@RegistrationDate) THEN
set @RegistrationDate=AttributeValue("...
1
vote
If condition for empty date field
You write, that you see the default date in the Ampscript code. Ampscript would never show a default date, if the data extension field and/or the variable is indeed empty. You don't write where or how ...
- 19.1k
0
votes
How to use Claiming of coupon codes in relation to Triggered Send where claimed coupon code also needs to be passed to Triggered Send Data Extension
There is an AMPScript function to make sure that rows are only claimed once, exactly to prevent the issue you described.
Its called ClaimRow. Please take a look.
EDIT:
If that doesnt resolve the issue ...
- 536
2
votes
Semi Colon Separated Values into a List - AMP Script
You can do it using the BuildRowsetFromString function:
%%[
set @list = "1 Orange;2 Apples;3 Peaches;5 Plums"
set @rows = BuildRowsetFromString(@list,";")
set @rowCount = ...
- 13.7k
1
vote
Accepted
Swapping images out using AMPscript
You can simply use if/else statement to display HTML image block based on the Gender attribute value.
For example:
%%[
set @gender = AttributeValue("Gender")
if @gender == "male&...
- 1,268
1
vote
Accepted
Targeting a nested array with SSJS to use with a for in loop in Marketing Cloud
I believe you would need to parse the JSON first and then use a loop to write keys and values in the nested JSON.
Try something like this in the email:
(assuming the DE is using as the data source in ...
- 1,268
1
vote
Accepted
SFMC Programming Language - AMPScript
Here are a few good ones.
https://ampscript.guide/ - This is basically a more detailed version of the documentation
https://ampscript.xyz/ - This has more specific use cases, but a lot of good ...
1
vote
Accepted
Multiple Filter Conditions on RetrieveSalesforceObjects
Unfortunately you can only match one value per field and there is no OR clause available for use when you add additional fields to match on, so you’d have to use a separate retrieve call for each of ...
- 13.7k
1
vote
How to limit Send of an email to 1000 subscriber only using ampscript
Would it be easier if you set up a staging data extension and an automation to pull in 1000 users daily to limit the audience size, assuming you're sending the email through a journey?
This way you ...
- 51
0
votes
Submitting HTML characters to a Data Extension via Landing Page and SSJS
Not sure if you still need this, but see my answer on this post.
AMPscript to decode HTML entity in data extension field
0
votes
Pass a value via CloudPageURL that will populate a SmartCapture hidden field
You can supply a query parameter to the hidden field of a Smart Capture form by entering the following into the Hidden Attribute text field in the Salesforce Marketing Cloud editor. In this case 'uuid'...
- 1
1
vote
Invalid index (parameter 2) passed to Row function. (boolean values)
Your code won't handle result sets of less than 7 rows. You'll need to check the number of rows returned before you loop.
%%[
SET @promo = Attributevalue('Is_promotion')
SET @lookOrders = ...
- 29.3k
Top 50 recent answers are included
Related Tags
ampscript × 3107marketing-cloud × 2984
email × 268
dataextensions × 262
ssjs × 258
cloudpage × 258
journeybuilder × 144
landing-page × 95
lookup × 88
content-builder × 88
marketing-cloud-connect × 77
mobileconnect × 74
javascript × 71
html × 71
api × 66
triggered-send × 57
email-studio × 56
email-template × 54
sms × 43
soap-api × 39
xml × 39
dynamic × 37
rest-api × 35
automationstudio × 34
gtl × 34