jake314159
  • Member for 6 years, 1 month
  • Last seen this week
AMPscript - Showing a fallback value if field is empty
Accepted answer
7 votes

I'm a fan of using the inline iif() AMPscript function. %%[ SET @rows = LookupRows("Contact_Salesforce","Id", _subscriberkey) if rowCount(@rows) > 0 then SET @row = row(@rows,1) SET @...

View answer
To replace all special characters using Ampscript
6 votes

The below AMPscript will replace any character that is not a number or letter with a 'z'. %%[ set @string = 'ab ab' for @i = 1 to length(@string) do set @char = substring(@string,@i,1) set @...

View answer
Specify a fie path for External SFTP Marketing Cloud
Accepted answer
5 votes

When you choose "External SFTP" as the location type, your Url field should have the absolute path to the ftp folder you need to access. Example: sftp://ftp.domain.com/folderForSFMC/ You can find ...

View answer
Utilizing Date Time Lookup in AMPScript on Marketing Cloud
Accepted answer
4 votes

The quotes around NOW()-60 and NOW()-30 are causing that code to be read as a text string. The DateAdd() AMPscript function can be used to calculate your dates, by using negative numeric values to ...

View answer
Will Update SQL In Automation Studio Remove Records That Don't Satisfy Requirement?
Accepted answer
4 votes

Updates values in the target where field name matches field returned by SQL Query for rows whose Primary Key the SQL query returns. Rows returned by SQL Query whose Primary Key does not exist in ...

View answer
SSJS to call Content Block with AMPscript
Accepted answer
4 votes

I've accomplished this by using the following SSJS: <script runat="server"> var ampscriptCode = Platform.Function.ContentBlockByID("####"); </script> The AMPscript was held in a regular ...

View answer
LinkName/alias not being recorded in the _click data view
Accepted answer
3 votes

After opening a case with SFMC support, we were provided this info: "The reason the link alias is not displayed is because the link is within an impression region for impression region tracking. ...

View answer
UpsertDE not working in cloud page using ssjs
2 votes

The UpsertDE method can be used in sendable contexts, such as email messages. UpsertData should be used in non-sendable contexts, such as landing pages. UpsertData: "Updates or inserts ...

View answer
Marketing Cloud Cloud Pages only accessible through email links
2 votes

I'd recommend checking out the HTTPRequestHeader() AMPscript function. Using that along with a CloudpagesURL() function in your email footers will allow you to only render the page for people coming ...

View answer
Using RedirectTo() with an #anchor on the URL
2 votes

This is definitely hacky, but it has worked for me in the past. You'll need to open a ticket with SFMC Support to request an update to your WAC string, so that the very last parameter name in your ...

View answer
Sql Action "Run Once" fails to pull records
2 votes

I would recommend creating an automation and running your query inside the automation. By doing it this way, you'll be able to see when the automation/query was started and when it finished. You can ...

View answer
Using AMP script and javascript
Accepted answer
2 votes

You can use the server-side javascript function Variable.SetValue() to pass your js variable value to an AMPscript variable. <script type="text/javascript" runat="server"> Platform.Load("core", ...

View answer
Assigning SSJS variable to AMPscript in a Loop
Accepted answer
2 votes

The code below will loop through all fields in a data extension and builds out a comma separated string. It then sets the @ampstring variable to that string. <script runat=server> Platform....

View answer
Translating own country identifier into SF culture code
Accepted answer
2 votes

Although dynamic culture codes are not supported in the default functionality of FormatCurrency(), you can "hack" it by utilizing the concat() and TreatAsContent() functions. The code below sets the @...

View answer
Adding AMPscript code to HTML
Accepted answer
2 votes

This is a very opened-ended question, but one small example would be: %%[ set @title = "This is the title of the html document" set @color = "#CCCCCC" ]%% <!DOCTYPE html PUBLIC "-//W3C//DTD ...

View answer
Data type not found in Data Extension creation
Accepted answer
1 votes

Here are the available data types for data extension fields: Text Number Date Boolean EmailAddress Phone Decimal For an image url, a text data type will work. Just be sure to make your field ...

View answer
Help Adding an IF statement to render unique text string in body copy
Accepted answer
1 votes

Although the proper opening %%[ is at the very beginning of the script, and the proper closing ]%% is at the very end of the script, blocks of AMPscript cannot be inside of another block (which is ...

View answer
LookupOrderedRows In cloudpages
1 votes

First, there should be quotes around your hard-coded values of 'con', 'hcp', and 'both'. The last 2 properties of the LookupOrderedRows() function are used as an AND clause, so your code is looking ...

View answer
AmpScript Rss Feed
1 votes

You can change the criteria of your loop to stop at 1 instead of @rowCount. That will pull only the first item. %%[ set @xml = HTTPGet("https://www.tpcc.org/_assets/feeds/blog.php?blogname=daily-...

View answer
Marketing Cloud Amp Script IF Statement
1 votes

If your sending data extension has a field named "First Name", the attributevalue() function will attempt to pull the value from there first. If that value is null or there is not a field named "First ...

View answer
Multiple OR Values in IF Statement
1 votes

In the case of just four possible matches, I would most likely do what you are already doing and just list them out and compare each. The solution below makes more sense if you have a ton of values to ...

View answer
Include The journey name in Data extract file
0 votes

Are you using a query to populate the DE that you are then extracting? If so, you can match the TriggererSendDefinitionObjectID on the _Sent data view to the JourneyActivityObjectID on the ...

View answer
How to create dateadd function in SSJS by calling dateadd in ampscript
0 votes

Here is one way to do this using the AMPscript DateAdd() function by invoking it with SSJS. I also included the AMPscript date format as a parameter, so that can be changed to match your desired ...

View answer
use ampscript for URL image on EMAIL TEMPLATE
Accepted answer
0 votes

You can use inline AMPscript in that text input for the image url. Assuming the value you want populated exists in a field on your sendable data extension, the AMPscript below should work. google....

View answer
how to empty a list without removing the list
Accepted answer
0 votes

The SSJS below will remove any subscribers from the list that you initiate, using the external key of the list. Since there is a limit of 2500 subscriber that can be retrieved, we're using a ternary ...

View answer
Extract error details from Triggered Sends?
Accepted answer
0 votes

You can run a Not Sent tracking extract, specifying the JobID for your send in order to see the "Reason" why those records were not sent. More info on the possible Reasons can be found at this link. ...

View answer
Fill a DE thanks to SSJS in Script Activity using an external API
0 votes

I agree with @MarkG, but one thing I noticed is that you are using JSON.parse(). With SSJS, you should use Platform.Function.ParseJSON() https://developer.salesforce.com/docs/atlas.en-us.mc-...

View answer
Empty is not equal to False in Data Extension?
0 votes

An empty or null value does not equal a false boolean value.

View answer
UpdateSingleSalesforceObject() on click
0 votes

If you're using the CloudPageURL() function, you can get the value for your subscriberkey on your CloudPage by using the _subscriberkey personalization string. Since that will be your ContactID, you ...

View answer
Don't understand where AMPscript bug comes from
0 votes

How was the email built? Content Builder? It's possible that the less than signs are causing issues. I have seen Content Builder try to treat less than signs as the first character of an html tag, ...

View answer