0

I have a custom preference centre and I want to be able to redirect to it from different BUs in my account. I am able to redirect OK and works as expected when I redirect from the BU where the cloud page is hosted but when I try from any other business unit I get the following message:

An error occurred when attempting to evaluate a RedirectTo function call. See inner exception for details. An error occurred when attempting to evaluate a InvokeCloudPagesURL function call. See inner exception for details. Error: Page not found. Either PageID is invalid or does not belong to BU.

Code on the page I am redirecting to:

%%[var @SubscriberKey,@email,@date
SET @SubscriberKey=RequestParameter('SubscriberKey')
SET @SalesforceID = Substring(@SubscriberKey, 0, 15)
SET @email=RequestParameter('email')
SET @MID=RequestParameter('MID')
SET @JobID=RequestParameter('JobID')



SET @rows=LookupOrderedRows('ENT.Trafalgar Preference Centre',1,'Contact ID desc','Contact ID',@SubscriberKey)

if rowcount(@rows)>0 then
SET @row = ROW(@rows, 1)


SET @travel_inspiration_topics = FIELD(@row,"travel-inspiration-topics")
SET @travel_regions = FIELD(@row,"travel-regions")
SET @travel_places = FIELD(@row,"travel-places")
SET @special_date_day = FIELD(@row,"special-date_day")
SET @special_date_month = FIELD(@row,"special-date_month")
SET @special_date_year = FIELD(@row,"special-date_year")
SET @travel_period_month=FIELD(@row,"travel-period_month")
SET @travel_period_year=FIELD(@row,"travel-period_year")
SET @contact_modes_email=Lowercase(FIELD(@row,"contact-modes_email"))
SET @contact_modes_mail=Lowercase(FIELD(@row,"contact-modes_mail"))
SET @mail_address_line1=FIELD(@row,"mail-address_line-1")
SET @mail_address_line2=FIELD(@row,"mail-address_line-2")
SET @mail_address_city=FIELD(@row,"mail-address_city")
SET @mail_address_state=FIELD(@row,"mail-address_state")
SET @mail_address_zip=FIELD(@row,"mail-address_zip")
SET @mail_address_country=FIELD(@row,"mail-address_country")
SET @travel_frequency=FIELD(@row,"travel-frequency")
SET @travel_history=FIELD(@row,"travel-history")
SET @travel_history_user_input=FIELD(@row,"travel-history--user-input")
SET @email_status_updates=FIELD(@row,"email-status-updates")
SET @mail_status_updates=FIELD(@row,"mail-status-updates")
SET @email_unsub_reason=FIELD(@row,"email-unsub-reason")
SET @email_unsub_reason_user_input=FIELD(@row,"email-unsub-reason--user-input")
SET @Added = FIELD(@row,"How were you added")
SET @MKTId = FIELD(@row,"Marketing Consent")
SET @DateSubmitted=FIELD(@row,"DateSubmitted")

else 

SET @travel_inspiration_topics = ""
SET @travel_regions = ""
SET @travel_places = ""
SET @special_date_day = ""
SET @special_date_month = ""
SET @special_date_year = ""
SET @travel_period_month=""
SET @travel_period_year=""
SET @contact_modes_email="true"
SET @contact_modes_mail="true"
SET @mail_address_line1=""
SET @mail_address_line2=""
SET @mail_address_city=""
SET @mail_address_state=""
SET @mail_address_zip=""
SET @mail_address_country=""
SET @travel_frequency=""
SET @travel_history=""
SET @travel_history_user_input=""
SET @email_status_updates=""
SET @mail_status_updates=""
SET @email_unsub_reason=""
SET @email_unsub_reason_user_input=""
SET @Added = ""
SET @MKTId = ""
SET @DateSubmitted=""

endif



IF @MID =='1080XXXX' THEN
set @BUname ='YYYYYYYY'

/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false", "Business_Unit_Text__c", "=" ,@BUname)
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
                    
                  
                   
                    ELSE 
                    ENDIF
                    
              ELSE 
              ENDIF
              
              
ELSEIF @MID == '105XXXXXX' then 
set @BUname ='YYYYYYYYY)'   

/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false", "Business_Unit_Text__c", "=" ,@BUname)
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
                    
                   
                    ELSE 
                    ENDIF
                    
              ELSE 
              ENDIF
              

ELSEIF @MID == '10XXXXXX' then 
set @BUname ='YYYYYYYYYY'

/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false", "Business_Unit_Text__c", "=" ,@BUname)
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
                    
                
                   
                    ELSE 
                    ENDIF
                    
              ELSE 
              ENDIF
              
ELSEIF @MID == '105XXXXXX' THEN 
set @BUname ='YYYYYYYYY'     

/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false", "Business_Unit_Text__c", "=" ,@BUname)
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
                    
                
                 
                   
                    ELSE 
                    ENDIF
                    
              ELSE 
              ENDIF
              
ELSEIF @MID == '10XXXXXXX' THEN 
set @BUname ='YYYYYYYYYY'

/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false", "Business_Unit_Text__c", "=" ,@BUname)
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
                    
                   
                   
                    ELSE 
                    ENDIF
                    
              ELSE 
              ENDIF
              
ELSEIF @MID == '105XXXXXX' THEN
set @BUname ='YYYYYYYYYY'

/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false", "Business_Unit_Text__c", "=" ,@BUname)
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
                    
          
                   
                    ELSE 
                    ENDIF
                    
              ELSE 
              ENDIF
              
ELSEIF @MID == '10XXXXXX' then
set @BUname ='YYYYYYYYYY'        

/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false", "Business_Unit_Text__c", "=" ,@BUname)
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
                    
                   
                    ELSE 
                    ENDIF
                    
              ELSE 
              ENDIF
              


ELSEIF @MID == '105XXXX' THEN
set @BUname ='YYYYYYYYY'

/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false", "Business_Unit_Text__c", "=" ,@BUname)
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
            
                   
                    ELSE 
                    ENDIF
                    
              ELSE 
              ENDIF
              


ELSEIF @MID =='10579XXX' THEN


/* Get Account information using the contact ID */

    SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId",
              "PersonContactId", "=", @SalesforceID)

 
     /* If it finds an account, get data from it */
    IF RowCount(@AccountRowset) > 0 THEN
                SET @AccountIsFound = "True"
                SET @AccountRow = Row(@AccountRowset,1)
                SET @AccountID = FIELD(@AccountRow, "Id")
                SET @Email = FIELD(@AccountRow, "PersonEmail")

    ELSE
    ENDIF
    
   IF @AccountIsFound == "True" THEN
   SET @MarketingConsentRowSet = RetrieveSalesForceObjects("Marketing_Consent__c", "Id, Opt_In__c, Customer_Active__c, Brand__c",
                "Customer_Active__c", "=",@AccountID, "Brand__c", "=", "0012000001BsNzwAAF", "Archived__c", "=", "false")
                
                   IF RowCount(@MarketingConsentRowSet) > 0 THEN
                    SET @ConsentIsFound = "True"
                    SET @MKTRow = Row(@MarketingConsentRowSet,1)
                    SET @Opt_in__c = FIELD(@MKTRow, "Opt_In__c")
                    SET @MKTId = FIELD(@MKTRow, "Id")
                    SET @FoundID = FIELD(@MKTRow, "Customer_Active__c")
                   
                    IF RowCount(@MarketingConsentRowSet) > 1 THEN
                        InsertDE("ENT.Trafalgar Error and Warning", "SubscriberKey", @SubscriberKey,
                                                          "Email", @Email,
                                                          "Status Message", "WARNING",
                                                          "Custom Message", "More Than One Active Marketing Consent Object Found",
                                                          "Error Date", NOW(),
                                                          "MKTId where changes are made",@MKTId,
                                                          "MID","Trafalgar")
                    ENDIF
                    
                    ELSE 
                      SET @Proceed = "False"
                    InsertDE("ENT.Trafalgar Error and Warning", "SubscriberKey", @SubscriberKey,
                                                          "Email", @Email,
                                                          "Status Message", "ERROR",
                                                          "Custom Message", "Marketing Consent Not Found",
                                                          "Error Date", NOW(),
                                                          "MID","Trafalgar")
                                                        
                    ENDIF
                    
              ELSE 
              ENDIF

ELSE
ENDIF
              
]%%
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, shrink-to-fit=no" />
    <title>Trafalgar - Preference Centre</title>
    <script>
      window.TTC_TECH_PREF_CENTRE_SUCCESS_PAGE = "https://pub.s4.exacttarget.com/pehdcpdqm1b"
      window.TTC_TECH_PREF_CENTRE_PRELOADED_VALUES = {
        // --------------------------------------------------
        // tab1
        "travel-inspiration-topics": "",
        "special-date": { 
          "day": "",
          "month": "",
          "year": ""
        },
        // --------------------------------------------------
        // tab2
        "travel-period": {
          "day": "01",
          "month": "",
          "year": ""
        },
        "travel-regions": "",
        "travel-places": "",
        "travel-frequency": "",
        "travel-history": "",
        "travel-history--user-input": "",
        // --------------------------------------------------
        // tab3
        "contact-modes": {
          "email": "",
          "mail": ""
        },
        "email-unsub-reason": "",
        "email-unsub-reason--user-input": "",
        // --------------------------------------------------
        // extra data to be submitted with the form
        "testing": "123"
        // --------------------------------------------------
      };
    </script>
    <link href="https://pub.s4.exacttarget.com/h2rpxsbdmo0" rel="stylesheet">
  </head>
  <body>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    this is your marketing consent %%=v(@MKTId)=%%
   <br>
    the sendable MID is %%=v(@MID)=%%
    <br>
    SubscriberKey is %%=v(@SubscriberKey)=%%
    <br> and changes i did in the IF logic in %%=v(@BUname)=%% and with the new logic for the BU names AND ENT.DE NAME
    <br> the email param passed in the URL: %%=v(@email)=%%
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <script src="https://pub.s4.exacttarget.com/tuh23irhure"></script>
  </body>
</html>


I am redirecting via the following URL: 



<a alias="" conversion="false" data-linkto="other" href="%%=RedirectTo(CloudPagesURL(1382,'SubscriberKey',_subscriberkey,'&email',emailaddr,'&MID',memberid,'&JobID',jobid))=%%" style="color:#302A3d;text-decoration:underline;" title="">Redirect to cloud page via CloudPageURL</a><br>

As mentioned above this works if I try from the account where page is located but I get the error in the pic attached when I attempt from the other business units.

What have I missed and what should I do in order to correct this?

Giulietta

2
  • redirect is done via: href="%%=RedirectTo(CloudPagesURL(1382,'SubscriberKey',_subscriberkey,'&email',emailaddr,'&MID',memberid,'&JobID',jobid))=%%"
    – Wallace
    Dec 16, 2019 at 9:40
  • 1
    if you remove the cloudpagesurl function and put in the cloudpage url this would work
    – EazyE
    Dec 16, 2019 at 14:14

1 Answer 1

3

The error message is self explanatory.

Cloud Pages are always BU-specific, you will not be able to link to another BU Cloud Page from your outbound Emails.

Simply recreate the Cloud Page in your BU you're trying to send from.

2
  • before I joined there was a solution where a very similar scenario was in place and there you could redirect from multiple business unit. the redirect link was very similar: href="%%=RedirectTo(CloudPagesURL(164, 'SubscriberKey',_subscriberkey))=%%"
    – Wallace
    Dec 16, 2019 at 9:56
  • 1
    thanks I realised that in the solution that was before and was working was because the page was hosted in the EID but in my use case I need it hosted at a child BU level. I have started replicating the cloud page to the BU level
    – Wallace
    Dec 17, 2019 at 8:04

You must log in to answer this question.

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