Skip to content

Instantly share code, notes, and snippets.

@chrishow
Created May 27, 2025 12:13
Show Gist options
  • Save chrishow/5fa5774634f2bb561dbd80275d3ef66e to your computer and use it in GitHub Desktop.
Save chrishow/5fa5774634f2bb561dbd80275d3ef66e to your computer and use it in GitHub Desktop.
Simple API to check Salesforce MCP data via cloudpages
<script runat="server">
Platform.Load("core","1");
HTTPHeader.SetValue("Access-Control-Allow-Origin","*");
HTTPHeader.SetValue("Content-Type","application/json");
</script>%%[
VAR @email, @rowCount
/* Capture email & competition from URL if passed */
SET @email = RequestParameter("email")
/* Default values */
SET @rowCount = 0
/* Lookup email in the Data Extension */
IF NOT EMPTY(@email) THEN
SET @rowCount = RowCount(LookupRows("Newsletter_Subscribers_NL", "email", @email))
ENDIF
]%%{"email": "%%=v(@email)=%%", "count" : "%%=v(@rowCount)=%%", "version":"6"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment