2

i found a great blog post by Adam Spriggs https://sprignaturemoves.com/prune-rows-data-extension-ssjs/

He mentioned to execute this function be built a landing page that posts to itself and calls the function.

This might be a very basic question but can someone tell me what this landing page would look like. I have tried some basic form submit but i continually get function undefined which i believe is because i am wanting to execute servcer side script.

Thanks!

2

There are various ways this might work. Here are a couple of examples...

AMPScript

%%[ IF @@ExecCtx == "LOAD" THEN]%%
    <form action="%%=RequestParameter('PAGEURL')=%%"> method="post">
        Name: <input type="text" name="name"><br>
        Email: <input type="text" name="email"><br>
        <input type="submit">
    </form>
%%[ ELSEIF @@ExecCtx == "POST" THEN]%%
    %%[/*Handle post here*/]%%
%%[ENDIF]%%

Server Side JavaScript

<script language="javascript" runat="server">
    Platform.Load("core", "1");

    if (Request.Method == "GET") {
</script>
    <form action="%%=RequestParameter('PAGEURL')=%%"> method="post">
        Name: <input type="text" name="name"><br>
        Email: <input type="text" name="email"><br>
        <input type="submit">
    </form>
<script language="javascript" runat="server">
    }
    else if (Request.Method == "POST") {
        // Handle post
        Write(Stringify(Request));
    }
</script>

I tend to assume I'm working with SSJS for Landing Pages, but it's a question of personal preferences for the most part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.