3

According to the documentation and The AMPScript Guide, it should be possible to control whether code in an AMPScript Block is interpreted by using a name for the script block.

I am aware of the known bug that the system variable @@ExecCtx (execution context) is currently always "Load".

So controlling script interpretation based on GET / POST method won't work at this stage- fine.

My question is - how should it work to specify a name?

Let's go with the example from the docs:

In this example, the UpsertData command executes only if the caller's execution context is set to POST and the name UpdateDate is specified:

%%[
/* note I fixed a typo in the documentation, there was a " missing */
[name="UpdateDate";type="Post"]
UpsertData("MyDE","Col1",Val1,"Col2",Val2)
]%%

Sounds interesting, but what is meant by 'specifying the name "UpdateDate"'? To my understanding, I basically gave this content block a name now. (plus, I said it should only run when POSTed to, which does not currently work)

Where/how am I expected to specify the name? So far I tried:

  • sending along name = UpdateDate in a POST request payload to the CloudPage that the code runs on
  • sending along name = UpdateDate in a POST request parameter to the CloudPage

Both with no visible effect.

3
  • are you need to update the data or can you please explain clearly – pkharries May 22 '19 at 12:11
  • There is no particular usecase to solve, I just want to understand the documentation and reproduce how the example given there is meant to work. – Jonas Lamberty May 22 '19 at 12:17
  • It used to work by including <input type="hidden" name="__contextName" id="__contextName" value="myform" /> in your form, but that was with Microsites. Did a quick test and it doesn't work with Cloudpages. – Josh de Blank May 23 '19 at 7:07

Your Answer

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

Browse other questions tagged or ask your own question.