0

Hi All,

I would like to request assistance on how I can redirect to a page using the CloudPagesURL value on a Lookup script?

I'm not sure if my code here is correct?
%%=Redirect('%%=CloudPagesURL(400)=%%')=%%

    Var @STATUS, @EMAIL, @AGENT_NAME
    Set @EMAIL= RequestParameter ('EMAIL')
    Set @AGENT_NAME= RequestParameter ('AGENT_NAME')
    
    SET @STATUS = Lookup('MYDATA', 'FLAG', 'EMAIL', @EMAIL)
    IF @Status == "Yes" THEN
    %%=Redirect('%%=CloudPagesURL(400)=%%')=%%
    ENDIF
    ]%%

Result is this:

enter image description here



My expected result should redirect to this page and also populating the fields:

enter image description here

Thanks in advance

3

you are inside an AMPScript definition block (opened by %%[ and closed by ]%%) so you do not need to (in fact, shouldn't) add the inline ampscript markings (%%= and =%%) for functions inside it.

This should be more like it (when used on a cloudpage):

%%[
IF @Status == "Yes" THEN
    Redirect(CloudPagesURL(400))
ENDIF
]%%

CloudpagesURL() is a function which evaluates to a string automatically, so I also removed the '' marking around it.

Note that in Emails, you have to use redirectTo(), not redirect() and here you have to place it inline or you will not be tracking the link.

Which would look like this:

%%[ IF @Status == "Yes" THEN
]%%%%=RedirectTo(CloudPagesURL(400))=%%%%[ENDIF]%%

See also: AMPScript Link Tracking - Does RedirectTo has to be Inline? Understanding

5
  • thanks for the answer. The form successfully redirected to Cloud Page 400. One thing I noticed is that the EMAIL and AGENT_NAME values where empty. I'm not sure if I need to Concat the values so that they are included on the transfer.
    – Harvey
    Jan 10 at 8:40
  • check this article, section "example from email": ampscript.com/cloudpagesurl-function - you have to add them into the CloudpagesURL function as can be seen there. Jan 10 at 8:50
  • like this? Redirect(CloudPagesURL(400,'EMAIL',@EMAIL,'AGENT_NAME',@AGENT_NAME))
    – Harvey
    Jan 10 at 8:54
  • looks correct, yes. Jan 10 at 8:54
  • 1
    it worked thanks :)
    – Harvey
    Jan 10 at 9:01

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.