[SalesForce] Retrieve parameter passed with MicroSiteURL() with SSJS

I'm trying to retrieve parameter that I passed with MicroSiteURL() on Landing Page I created. I tried multiple approaches
URL:

MicroSiteURL(10000, "oneClickUnsubscribe", "true")

Code:

%%[
var @oneClickUnsubscribe
set @oneClickUnsubscribe = QueryParameter('oneClickUnsubscribe')
]%%
<script runat="server">
Platform.Load('core', '1');
Write(Attribute.GetValue('oneClickUnsubscribe') + ': Attribute.GetValue<br>');
Write(Platform.Request.GetCookieValue('oneClickUnsubscribe') + ': Platform.Request.GetCookieValue<br>');
Write(Platform.Request.GetFormField('oneClickUnsubscribe') + ': Platform.Request.GetFormField<br>');
Write(Platform.Request.GetQueryStringParameter('oneClickUnsubscribe') + ': Platform.Request.GetQueryStringParameter<br>');
Write(Platform.Variable.GetValue('@oneClickUnsubscribe') + ': Platform.Variable.GetValue<br>');
</script>

Only option that works for me is the last one. Is there a way to do it just with SSJS?

Best Answer

I've found that you can only retrieve that using the RequestParameter() AMPScript function.

Here's an example:

<script type="text/javascript" runat="server">

Platform.Load("core", "1.1.1");  

// other code
  
</script>
%%[
set @oneClickUnsubscribe = RequestParameter("oneClickUnsubscribe")
]%%
<script type="text/javascript" runat="server">
  
var oneClickUnsubscribe = Variable.GetValue("@oneClickUnsubscribe");
  
// other code

</script>
Related Topic