2

I have created a CloudPage for when the user clicks the "YES" CTA button that should be captured and redirect to the URL.

I have done the following and I am able to capture the response and update in the Lead object but can't redirect to the URL. Can someone tell me how to redirect to the URL when the page loads?

%%[
SET @Id = RequestParameter("Id") 
SET @Response =RequestParameter("Response") 
SET @upload = UpdateSingleSalesforceObject("Lead",@Id,"Consultation_Attended__c",@Response)
]%%

%%[IF @Response =="Yes" THEN ]%%
%%=RedirectTo("www.google.com")=%%
%%[ELSE]%%
%%=RedirectTo("www.yahoo.com")=%%
%%[ENDIF]%%

%%=v(@upload)=%%

1 Answer 1

4

If you simply need to redirect straight away without any validation then you were close to the solution -

%%[

SET @Id = RequestParameter("Id") 
SET @Response = RequestParameter("Response")
SET @upload = UpdateSingleSalesforceObject("Lead", @Id, "Consultation_Attended__c", @Response)

IF @Response == "Yes" THEN
    Redirect("https://www.google.com")
ELSE
    Redirect("https://www.yahoo.com")
ENDIF

]%%

The issue was in 2 points:

  1. You need to use Redirect AMPscript function because you cannot use the RedirectTo one, since:

    This function is required when using the <a> HTML hyperlink tag in emails when the hypertext reference (href) attribute is either an attribute or a variable and the hyperlink is a tracked email link.

  2. Also, you got to have full links, including https:// in the start to not retrieve Bad Request response on the page.

You must log in to answer this question.

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