-
-
Save danieldrasdo/c6f4d6a10cb23b6870be3a3ad4d225bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Great Adam Spriggs suggestion... | |
https://salesforce.stackexchange.com/questions/145037/developing-and-testing-cloudpages | |
...is to use TreatAsContent() to bypass the CloudPage caching | |
%%=TreatAsContent(HttpGet(Concat("https://www.domain.com/your/webhook.html?x=",GUID())))=%% | |
*/ | |
<script runat="server"> | |
Platform.Load("core","1.1.1"); | |
/* | |
Example that handles JSON data POSTed to this page. | |
e.g '{"firstname":"Joe","lastname":"Bloggs"}' | |
*/ | |
var jsonPost, jsonData; | |
//Use JSON in post content | |
jsonPost = Platform.Request.GetPostData(); | |
if (jsonPost.substring(0, 1) != '-') { | |
// Parse JSON | |
jsonData = Platform.Function.ParseJSON(jsonPost); | |
var FirstName = jsonData.firstname; | |
var LastName = jsonData.lastname; | |
Write("Hello " + FirstName + " " + LastName); | |
// Hello Joe Bloggs | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment