Find your content:

Search form

You are here

Fuel SDK + PHP + Sendable Data Extension

 
Share

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(); 

Attribution to: Zach

Possible Suggestion/Solution #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))


Attribution to: Bryan Ingram

Possible Suggestion/Solution #2

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
      )
    );

Attribution to: Zach

Possible Suggestion/Solution #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);

Attribution to: Dave Helms
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33999

My Block Status

My Block Content