1

When trying to use 'redirect', my 'starting' page will no longer load (returning the 500 error). Not sure what I'm doing wrong here. FYI: If I remove the redirect code, the page loads just fine. Here's the code:

    %%[
var @ne,@jw,@ca,@co,@np,@le,@pu,@subkey,@neoch,@jwoch,@caoch,@leoch,@puoch,@npoch,@cooch


set @subkey = Lookup('Site License Opt Out','SubscriberKey','EmailAddress',requestparameter('ea')) 

if not(empty(@subkey)) THEN

if requestparameter('display')=='optin' THEN
 
   set @neoch = 'TRUE'
        set @jwoch =  'TRUE'
          set @caoch =  'TRUE'
           set @leoch =  'TRUE'
        set @puoch =  'TRUE'
         set @npoch =  'TRUE'
        set @cooch =  'TRUE'

ELSE

if not(empty(requestparameter('neop'))) THEN
set @neoch = 'TRUE'
ELSE
set @neoch = 'FALSE'
ENDIF

if not(empty(requestparameter('jwop'))) THEN
set @jwoch = 'TRUE'
ELSE
set @jwoch = 'FALSE'
ENDIF

if not(empty(requestparameter('caop')))  THEN
set @caoch = 'TRUE'
ELSE
set @caoch = 'FALSE'
ENDIF

if not(empty(requestparameter('leop')))  THEN
set @leoch = 'TRUE'
ELSE
set @leoch = 'FALSE'
ENDIF

if not(empty(requestparameter('puop'))) THEN
set @puoch = 'TRUE'
ELSE
set @puoch = 'FALSE'
ENDIF

if not(empty(requestparameter('npop')))  THEN
set @npoch ='TRUE'
ELSE
set @npoch = 'FALSE'
ENDIF

if not(empty(requestparameter('coop')))  THEN
set @cooch = 'TRUE'
ELSE
set @cooch = 'FALSE'
ENDIF
ENDIF
    
 UPSERTDATA(
 'Site License Opt Out',1,
'SubscriberKey',@subkey,
'EmailAddress',requestparameter('ea'),
'nestatus',@neoch,
'jwstatus',@jwoch,
'castatus',@caoch,
'pustatus',@puoch,
'costatus',@cooch,
'npstatus',@npoch,
'lestatus',@leoch
)
ENDIF
  ELSE 
  Redirect(cloudpagesURL(2024,'display','Stuff'))
ENDIF

]%%

1 Answer 1

0

From the docs:

CloudPagesURL...

Provides a way for users to reference a CloudPages URL in an account from an email message

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/cloudpagesurl.htm?search_text=cloudpagesURL

CloudPagesURL has to be used from within an email. The point is to encrypt data that would otherwise be plain in a GET request (link), as that is all that is available in an email.

If you are trying to send data from (cloud)page to (cloud)page, you don't have that problem. You can just use a POST Request, e.g. httppost2 instead of encrypting data in the link directly. https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/httppost2.htm

The receiving page can then use RequestParameter() all the same, doesn't matter if you POST data to it or have parameters in the link / GET Request.

8
  • Thanks for the response. However, can 'redirect' work on a cloud page if I remove the Cloudpages URL and use a 'regular URL' (i.e. www.google.com)? Because when I remove the CloudPages URL and put in a regular URL, it doesn't seem to work, but I'm not sure if it's because 'redirect' just doesn't work on a cloudpage or if something is just wrong with how I coded the 'redirect'
    – setratus
    Commented Mar 18, 2021 at 19:24
  • It should work. Redirect is meant for cloudpages, RedirectTo is meant for emails. Redirect('https:///www.google.com') should be fine. Commented Mar 18, 2021 at 19:26
  • For some reason it's not working for me... and if I remove it, the page opens up just fine... argh!
    – setratus
    Commented Mar 18, 2021 at 19:43
  • put it inline, outside of the definition block: %%=Redirect('http://example.com')=%% Commented Mar 18, 2021 at 19:49
  • Still get the spinning wheel of doom even when going inline. I used %%=Redirect('https:///www.google.com')=%%. Going to have to log a help ticket for this one
    – setratus
    Commented Mar 19, 2021 at 16:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .