2

We are builing landing pages using ampscript to unsubscribe email address submitted via these pages. The pages should check for email address to existing subscriber and unsubscirbe them or create new subscriber on All Subscriber List

This works fine when the landing pages are on Enterprise Admin account. But the landing pages behave strangely when we localize it to one of child bus unit. The api create/update calls show success but the subscriber cannot be found in the UI. Can one the dev team assist here with code placed under child business unit or should all the landing pages be on the parent account. The mid is always changed to whatever bus unit the landing page is accessed from. Thanks Below is code sample

/* ===================================================== */
/*              CREATE SUBSCRIBER OBJECT                 */
/* ===================================================== */

SET @sub = CreateObject("Subscriber")

SetObjectProperty(@sub, "SubscriberKey", @subkey)
SetObjectProperty(@sub, "EmailAddress", @e)
SetObjectProperty(@sub, "Status", "Unsubscribed")
/*SetObjectProperty(@sub, "Status", "Active")*/

/* ===================================================== */
/*                CREATE CLIENT OBJECT                   */
/* ===================================================== */

SET @cid = CreateObject("ClientID")

SetObjectProperty(@cid, "ID", @mid)
SetObjectProperty(@sub, "Client", @cid)    

/* ===================================================== */
/*                      INVOKE CREATE                    */
/* ===================================================== */

SET @statusCode = InvokeCreate(@sub, @statusMsg, @errorCode)

IF @TestMode == true THEN
]%%

<b>InvokeCreate Subscriber/Client</b> Object statusCode : %%=v(@statusCode )=%%<br/>
<b>InvokeCreate Subscriber/Client</b> Object errorCode: %%=v(@errorCode)=%%<br/>
<b>InvokeCreate Subscriber/Client</b> Object statusMsg: %%=v(@statusMsg)=%%<br/><br/><br/> 

%%[
ENDIF

/* ===================================================== */
/*                      INVOKE UPDATE                    */
/* ===================================================== */

IF @statusCode == "Error" THEN
    set @type = "update"
    SET @statusCode = InvokeUpdate(@sub, @statusMsg, @errorCode)
ENDIF

IF @TestMode != true THEN
    IF @statusCode == "Error" THEN
        Redirect(@error_url)
    ENDIF
ENDIF
0

ClientID is a deprecated object. I'd suggest trying to set the ID property on @sub and see what happens.

****EDIT*******

I reread your question and I should have seen this before. There is only one AllSubs list in an ENT2.0 account. The child BU's all use the same allSubs list as the parent. So, the pages should all be at the top (enterprise level). You can use others lists (not AllSubs) at the Child BU level.

  • Thanks Samuel for taking a look. Can you give me an example of how to set the ID property without using ClientID. I picked this code from one of the API documentation. – Sakina Rahman Jun 5 '14 at 15:06
  • Thanks Tim I appreciate your response and it is clear now that we have to move the landing pages to parent account to make this work. – Sakina Rahman Jun 5 '14 at 18:49

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.