4

I've been constructing a subscriber profile center to be integrated with my company's Drupal site using a custom module, and I've run into a snag. I can create new subscribers and modify them easily, but I can't seem to modify the Preference properties/attributes.

Inside of my subscriber creation function, I do:

$subscriber->props = array(
    "Name" => $full_name,
    "EmailAddress" => $values['email_address'],
    "Attributes" => array(
        array('Name'=>'Full Name', 'Value' => $full_name),
        array('Name'=>'First Name', 'Value' => $values['first_name']),
        array('Name'=>'Last Name', 'Value' => $values['last_name']),
        array('Name'=>'Customer Number', 'Value' => $values['customer_number']),
        array('Name'=>'Business Name', 'Value' => $values['business_name']),
        array('Name'=>'State', 'Value' => $values['state']),
        array('Name'=>'City', 'Value' => $values['city']),
        array('Name'=>'Operation Type', 'Value' => $values['operation_type']),
        array('Name'=>'Menu Type', 'Value' => $values['menu_type']),
        array('Name'=>'Job Title', 'Value' => $values['job_title']),
    )
);

This works fine for setting or modifying the subscriber's personal info. $values is just the array of field inputs from the form this sits behind.

However, if I extend this to something like:

$subscriber->props = array(
    "Name" => $full_name,
    "EmailAddress" => $values['email_address'],
    "Attributes" => array(
        array('Name'=>'Full Name', 'Value' => $full_name),
        array('Name'=>'First Name', 'Value' => $values['first_name']),
        array('Name'=>'Last Name', 'Value' => $values['last_name']),
        array('Name'=>'Customer Number', 'Value' => $values['customer_number']),
        array('Name'=>'Business Name', 'Value' => $values['business_name']),
        array('Name'=>'State', 'Value' => $values['state']),
        array('Name'=>'City', 'Value' => $values['city']),
        array('Name'=>'Operation Type', 'Value' => $values['operation_type']),
        array('Name'=>'Menu Type', 'Value' => $values['menu_type']),
        array('Name'=>'Job Title', 'Value' => $values['job_title']),
        array('Name'=>'Restaurant Newsletter Subscription', 'Value' => $values['restaurant_newsletter_subscription']),
    )
);

('Restaurant Newsletter Subscription' is one of the Preference Attributes for subscribers on this account)

This returns an error:

Exception occurred during [CreateSubscriber] ErrorID: 1379757604

The subscriber is still created, but nothing in [Attributes] is modified, all values are set to defaults. Removing the offending subscription line restores this to be functional again.

Manually adding the subscriber to the lists they checked off using the convenience method provided in the SDK works great, but this preference does not toggle automatically.

Is there any way to modify these attributes from the code side? All of the documentation provided by ExactTarget only talks about doing this either in their default profile center (not used in this case), or done manually in the administrative interface (not helpful). I'm sure there's just some small stupid detail about these attributes that I'm missing, but there's no documentation to check to be sure.

  • What are you passing as the value for the 'Restaurant Newsletter Subscription'? True/false? 1/0? – Mac Apr 23 '15 at 15:35
  • I've tried it as: True/False, 1/0, and Yes/No. All 3 cases generate this error. – baronvonvaderham Apr 23 '15 at 15:53
1

I just tried the following where MyPref is a preference in the account and I passed a string "True". It worked.

$subCreate = new ET_Subscriber();
$subCreate->authStub = $myclient;
$subCreate->props = array("EmailAddress" => $SubscriberTestEmail, "Attributes" => array(
    array('Name'=>'MyPref', 'Value' => "True")));
$postResult = $subCreate->post();
print_r('Post Status: '.($postResult->status ? 'true' : 'false')."\n");
print 'Code: '.$postResult->code."\n";
print 'Message: '.$postResult->message."\n";    
  • There's some weirdness going on where I posted this question as a guest but the new account I created didn't take ownership of it, so now I can't actually comment or vote on anything :( Anyway, this answer solved it! That was the one thing I hadn't tried, passing the actual string "True". I knew it would be something dumb like that. – user18999 Apr 23 '15 at 16:40

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.