2

I cannot figure out how to make a Data Extension sendable using the PHP version of the Fuel SDK.

The documentation describes both the SendableDataExtensionField and SendableSubscriberField as string datatypes, but that results in an Error 2.

A comment on another question suggests using nested arrays, but that returns SendableSubscriberField and SendableDataExtensionField cannot be blank errors.

Also, I know that this account uses "Email Address" for it's Sendable Subscriber Field.

My current code:

  $myclient = new ET_Client(true);

  $DataExtensionNameForTesting = "TestForTim";
  $postDE = new ET_DataExtension();
  $postDE->authStub = $myclient;
  $postDE->props = array(
    "Name"                       => $DataExtensionNameForTesting, 
    "CustomerKey"                => $DataExtensionNameForTesting,
    "IsSendable"                 => "true",
    "SendableDataExtensionField" => "EmailAddress",
    "SendableSubscriberField"    => "EmailAddress"
    );
  $postDE->columns = array();
  $postDE->columns[] = array(
    "Name"         => "EmailAddress", 
    "FieldType"    => "EmailAddress", 
    "IsPrimaryKey" => "true",
    "MaxLength"    => "100", 
    "IsRequired"   => "true"
    );
  $postDE->columns[] = array(
    "Name"      => "FirstName", 
    "FieldType" => "Text"
    );
  $postResult = $postDE->post(); 

3 Answers 3

6

The key seems to be two-fold -

  1. Adding a (NULL) value attribute to the SendableDataExtensionField and SendableSubscriberField objects
  2. Despite the documentation stating that the SendableSubscriberField specifies EmailAddress (or _SubscriberKey if the account dictates), the object actually expects Email Address (with the space in between the words).

(Have y'all thought about open sourcing the documentation; would be awesome to submit a pull request for these discrepencies)?

Successful code:

  $postDE->props = array(
    "Name"                       => $DataExtensionNameForTesting, 
    "CustomerKey"                => $DataExtensionNameForTesting,
    "IsSendable"                 => "true",
    "SendableDataExtensionField" => array(
      'Name' => 'EmailAddress',
      'Value' => NULL
      ),
    "SendableSubscriberField"    => array(
      'Name' => 'Email Address',
      'Value' => NULL
      )
    );
2
  • Hey Zach, thanks for your help! And we are actually working right now on a new documentation site which would allow for the ET developer community to submit pull requests for exactly that reason.
    – Dave Helms
    Commented May 7, 2014 at 16:39
  • Wow yeah, documentation would be nice.... Since I have subscriber key turned on in our account, "Subscriber Key" worked for me ins SendableSubscriberField Commented Jul 18, 2019 at 13:55
3

Those fields are expecting an object, not a string, so please change the following lines:

"SendableDataExtensionField" => "EmailAddress",
"SendableSubscriberField"    => "EmailAddress"

to look like this:

"SendableDataExtensionField" => array("Name" => "EmailAddress"),
"SendableSubscriberField" => array("Name" => "EmailAddress")

If this does not resolve the problem, please log your SOAP envelope and provide it so we can see what's being sent. You can enable debugging by changing the first line to include an extra parameter with value "true", like this:

 $myclient = new ET_Client(true, true);
1
  • Thanks @Dave; that, unfortunately, doesn't solve it. Your suggestion results in a SOAP error: "SOAP-ERROR: Encoding: object has no 'Value' property." I also tried adding a Value property to the object, but to no avail - "The SendableSubscriberField field cannot be blank." The code and resulting soap envelope when trying to add a Value property: "SendableDataExtensionField" => array("Name" => "EmailAddress", "Value" => "EmailAddress"), "SendableSubscriberField" => array("Name" => "EmailAddress", "Value" => "EmailAddress") Soap envelope linked here
    – Zach
    Commented May 1, 2014 at 17:50
1

To add to Zach's answer for those of us using Subscriber Keys; when setting SendableSubscriberField.Name, you should use the value of "Subscriber Key" with a space, rather than "_SubscriberKey" or "SubscriberKey".

When using a new contact to fire an event, you can pull DE data into your email like:


Lookup("your_de_name","de_field_to_pull_in","de_field_to_match_on",_SubscriberKey))

You must log in to answer this question.

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