New to Salesforce Marketing Cloud and wondering what you can do with Ampscript? In this series of posts, I'll show you somethings that can make the "your form doesn't work" emails go away, how to make content blocks more friendly and even how to run ampscript in Automation Studio. Let's start with reducing the number of emails you get from sales telling you that the person can't submit their survey response.
Your Form Doesn't Work
%%[var @rows, @row, @rowCount, @lookupset @lookup = RequestParameter('c')set @rows = LookupRows("TargetDataExentions","SubscriberKey", @lookup)set @rowCount = rowcount(@rows)]%%
The RequestParameter command tells SFMC to look in the click string to find the record's unique identifier. If you're familiar with this you're probably putting that in your hidden field for the value. If you are, then you'll replace that with %%=v(@lookup)=%%.
Then above your Smart Capture form add an html block. In that block you'll put:
%%[ IF @rowCount <= 0 THEN ]%%
Then below your Smart Capture form, add another html block. In that block you'll put:
%%[ ELSE ]%%
Then a free form block, that includes a statement like: "We appreciate your enthusiasm, but you've already replied to our survey! If you need assistance or would like to add to your response, please contact us as surveys@yourcompany.com".
Follow that block with a final html content block with the following:
%%[ ENDIF ]%%