New answers tagged

0 votes

Distributed Marketing displays error during email preview

When previewing the Distributed Marketing email from Experience Cloud, the _MessageContext AMPscript personalization contains a value of 'PREVIEW'. Since the Destributed Marketing email preview does ...
user avatar
  • 2,585
2 votes
Accepted

You have sent us an Illegal URL or an improperly formatted request. error in marketing cloud for <a> tag using AMP Script

The issue is your utm_term parameter which appears to be the linkname personalization string. If you add an alias to the <a tag such as: <a href="%%redirectto(@url1)%%" alias='CTALink'&...
user avatar
  • 7,367
1 vote
Accepted

How to get only href value from link using AMP script?

You can use regular expression in Ampscript. This will isolate the link from within the a tag in your ampscript variable. You can then use the link within RedirectTo function, allowing you to have it ...
user avatar
  • 16.9k
1 vote
Accepted

Avoid break line when the field is empty breakline

Judging from your comment: The line breaks that were physically entered between your variables are the problem. Since you previewed as text - pure text emails understand and display them as line ...
user avatar
1 vote
Accepted

Retrieve info from another DE in Ampscript

You simply need to have a fallback scenario in your script, which is triggered in case no matching records are found in your vol_Newsletter data extension. Keep in mind, that LookupRows function ...
user avatar
  • 16.9k
0 votes

How change label in <a> tag in email template?

Your question is really unclear, but I will do my best giving it a shot. I assume you want to replace Test in the HTML contained in your @URL1 variable with a proper LastName taken from somewhere else....
user avatar
  • 16.9k
2 votes
Accepted

Data Extension Caching when doing Lookups

SFMC has some caching settings/business rules for small Data Extensions. I'd suggest opening a support case to see if it can be adjusted. There's a hint about it in this knowledge base article. ...
user avatar
  • 27.8k
0 votes
Accepted

Pass a variable from AMPscript block to Client side JS?

You can just print the ampscript variable where you normally set a client-side javascript variable. In the below example, I set the cid to the contactId ampscript you already declare in the top: %%[ ...
user avatar
  • 16.9k
0 votes

how to use child standard object data in the personalized mail while your journey salesforce data entry event is on parent object

I've been able to figure out what was wrong. Please check the code right below that might help others. %%[ var @Rows, @Row, @ContactId, @TeamID, @Name set @ContactId= ContactId set @Rows = ...
user avatar
  • 1
2 votes

ampscript lookup to limit number of rows to display if there are more than 5 records

You'll need to check the rowCount of your lookup first. If there are less than 5 rows it won't compile. <table border="1"> <tr> <th>Order Number</th> <th>...
user avatar
  • 27.8k
0 votes

IF Ampscript - if a record from one data extension exists in another

You have to identify how a record in DE A is same as the one in DE B. Then you can use LookupRows function. I would combine it with Iif function. Here is a sample in email: %%[ set @value = ...
user avatar
  • 136
0 votes

AMPscript: Using date in LookupOrderedRows is not working

When you do the Lookup with just the "Date" value (MM/dd/yyyy), the SFMC assumes the time to be "12 AM". Hence it will look for the same exact date with time as 12AM.
user avatar
0 votes

Is there any AMPscript live editor available?

Yes there is! You can use ampscript.so, we have an AMPscript live editor and preview tool with syntax highlighting and autocomplete. It is perfect if you just want to learn AMPscript or host your ...
user avatar
1 vote
Accepted

AMPScript convert "feb" to 02

You can use FormatDate function in AMPscript to do that. Try this: %%[ VAR @OPT2, @FormattedDate SET @OPT2 = QueryParameter("OPT2") SET @FormattedDate = FormatDate(@OPT2, 'dd-...
user avatar
  • 136
-1 votes

InsertDE not working in email ampscript and block the preview

it's probably because there is an issue with the target data extension. We had the same problem and it was because we had one field set as a primary key that we were not specifying inside the ...
user avatar
1 vote
Accepted

Product name upsert to a data extension on click and redirection to cloud thank you landing page through AMPscript

This is fairly simple to do. There are 2 options on how to do this. Create a processing page to collect the product and upsert into the DE then redirect to landing page Create a landing page that ...
user avatar
  • 27.9k
2 votes
Accepted

How to optimize the email AMPscript code that has a lot of lookups?

You can create one central Content Data Extension and then pull from it all the needed 30 fields based on the email name using LookupRows AMPScript function. That would be definitely more efficient ...
user avatar
  • 2,306
1 vote
Accepted

Pass the value from email to a content block using AMPscript

Ampscript gets evaluated top to bottom. So any declaration of variable further down in your code (whether it is within the email itself, or in a referenced content block) will always overwrite any ...
user avatar
  • 16.9k
2 votes
Accepted

Can you populate SendLog DE with a different value than the one in target DE matching field?

First of all, there are four ways of populating a custom field in the Email SendLog: 1.1‏‏‎ Matching field name in the Sendable DE 1.2‏‏‎ Matching attribute name passed in the API's Payload (e.g. ...
user avatar
  • 2,306
0 votes

Can you populate SendLog DE with a different value than the one in target DE matching field?

You can freely add columns to your sendlog, and they will be automatically populated, provided that column names match the ampscript variable names. Meaning, that if you add Brand column to sendlog DE,...
user avatar
  • 16.9k
0 votes
Accepted

Check a field for a single letter

Based off of the info from the comments mentioning this has to be done in email in 'real time', the easiest way I can think of to test this via AMPscript is to do the following: Set the string into ...
user avatar
  • 27.9k
3 votes

Why are some clicks not being tracked?

The reason should be that the RedirectTo function has to be used as %%=RedirectTo()=%% inside an href. In other words, is has to be inline AMPScript. You are using it in an AMPScript definition block, ...
user avatar
0 votes

CreateSalesforceObject creating multiple records

It's because you're using ">" operator instead of "==" for ROWCOUNT function. If you change it to IF rowcount (@getAccId) == 1 then ..it will limitate to a single record.
user avatar
4 votes
Accepted

Reference a field within AmpScript in an email

This is how you use within AMPscript: %%[ var @myname set @myname = AttributeValue('FirstNameColumnName') ]%% My Name: %%=v(@myname)=%% Check out for more info : https://ampscript.guide/...
user avatar
0 votes

How to Make API Call from SFMC Cloud page to External System

This bit looks wrong: var accessToken = {{yourAccessTokenWhichShouldNeverBePublicOnPagesLikeThis}}; Change it to: var accessToken = 'yourAccessTokenWhichShouldNeverBePublicOnPagesLikeThis';
user avatar
0 votes
Accepted

Using Ampscript to Look Up Rows with an OR condition

Using that method for a data extension does not seem possible: either find another method for you needs OR you could calculate it in another field. and using your Column and Value to get those rows E....
user avatar
1 vote

Multiple UpsertDEs not working

Since it is for all the same Subscriber on the same DE, you do not need to do multiple calls, you can just combine it all into a single Upsert. There are some caching and processing issues with doing ...
user avatar
  • 27.9k
0 votes

Retrieving the object ID that trigger journey builder entry event by Ampscript

I did perform searches but was unable to find the answer, but now I found two similar threads The answer is Set @OpportunityId = Opportunity:Id. You can also find the Data Extension created for your ...
user avatar
0 votes
Accepted

UpdateSingleSalesforceObject with dynamic Field Value

To understand better what is wrong either run your AMPscript in the email or add a try-catch SSJS block on the CloudPage to get an error message. This way you will narrow down the problem. ...
user avatar
  • 2,306

Top 50 recent answers are included