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.
<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