I had followed this trailheadand the github code. Successfully apply to one of my org, but when I'm trying to copy to the another org, somehow it's not working. I had adjust the variety of cloudpage ID, subscriberkey and email. But, when I send an email to myself and click the cloudpage link, I'm not able to successfully log in my subscribe data.

<div style="display:none;">
   SET @SubscriberKey = [_subscriberkey]
   SET @EmailAddress = [emailaddr]

      IF EMPTY(@SubscriberKey) OR EMPTY(@EmailAddress) THEN
          SET @error = true


          SET @preferenceCenterLink = CloudPagesURL(3490)
          SET @Status = 'Unsubscribed'
          SET @results = UpsertData('MBPassUnsubscribeList',2, 'EmailAddress', @EmailAddress, 'SubscriberKey', @EmailAddress, 'EDMStatus', @Status, 'ModifiedDate', Now())

          SET @vv1 = CreateObject("RetrieveRequest")
          SetObjectProperty(@vv1, "ObjectType", "Subscriber")

          SET @mbv2 = CreateObject("SimpleFilterPart")
          SetObjectProperty(@mbv2, "Property", "SubscriberKey")
          SetObjectProperty(@mbv2, "SimpleOperator", "equals")
          AddObjectArrayItem(@mbv2, "Value",@SubscriberKey)
          SetObjectProperty(@mbv2, "Filter", @mbv2)
          SET @ResultSet = InvokeRetrieve(@mbv2)

          IF Rowcount(@ResultSet) == 1 THEN
              SET @row = ROW(@ResultSet,1)
              IF Field(@row,"Status") != @Status THEN
                  SET @sub = CreateObject("Subscriber")
                  SetObjectProperty(@sub,"EmailAddress", @EmailAddress)
                  SetObjectProperty(@sub,"SubscriberKey", @SubscriberKey)
                  SET @options = CreateObject("UpdateOptions")
                  SET @save = CreateObject("SaveOption")
                  AddObjectArrayItem(@options,"SaveOptions", @save)
                  SET @update_sub = InvokeUpdate(@sub, @update_sub_status, @update_sub_errorcode, @options)


<div class="content-wrapper">
  <div class="pref-block-noborder form-wrapper-noborder">
    %%[ IF @error THEN ]%%
    <div class="pref-block-noborder form-wrapper-noborder">
      <p class="slds-text-heading_small" style="font-size: 1.45rem"> Error </p>

    %%[ ELSE ]%%

    <div class="pref-block-noborder form-wrapper-noborder">
      <p class="slds-text-heading_small" style="font-size: 1.45rem">
        Thank you!You had successfully unsubscribe.
    %%[ ENDIF ]%%
  • SSL is working.

Hope there's anyone can give me some hint.

Thanks a lot!

Best, Victoria

  • 1
    Custom code does NOT work just by copy n pasting, you may have to make necessary adjustments. Ex: you need to update CloudPage ID and DE names... CloudPagesURL(3490) ... MBPassUnsubscribeList is valid and relevant DE. Feb 13 at 9:38
  • 1
    What exactly isn’t working, are you getting a 500 error or something else? I’d recommend wrapping your whole script in a try/catch to be able to troubleshoot it better (sfmarketing.cloud/2019/08/09/debugging-ampscript)
    – zuzannamj
    Feb 13 at 10:16
  • Hello Vishal, we did adjust those variety as cloudpage ID and DE name, and created a DE for the same name and attribute...
    – Vee WANG
    Feb 14 at 3:18
  • Hello zuzannamj, seems that we had right amp script, but somehow the page not able to catch the subscriberkey and email that not able to successfully unsubscribe.
    – Vee WANG
    Feb 14 at 3:19
  • [update]When we set true data ( Subscriberkey & Email )to the code, it works. Therefore it means that the variety written way is wrong that not sure how to make it right? Shall we need to embed the variety in the link as well? Many Thanks.
    – Vee WANG
    Feb 14 at 6:40

1 Answer 1


[Final update]The code is correct. When sending those email, remember to set the link as cloudpageID, not the cloudpage link.

You must log in to answer this question.

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