I have been trying to create a DataExtention using the FuelSDK.
I followed this example
My code snippet looks like:
$this->_dataExtensions->props = [
'Name' => $content['name'],
'Description' => 'Sync - ' . date('Y-m-d H:i:s'),
'CustomerKey' => $content['key'],
'IsSendable' => 'true',
'SendableDataExtensionField' => ['Name' => 'EmailAddress', 'Value' => 'primaryEmail'],
'SendableSubscriberField' => ['Name' => 'Subscriber Key', 'Value' => 'CustomerKey'],
];
I have SUBSCRIBER_KEY
on in the account. btw.
But the API response gives me
[results] => Array
(
[0] => stdClass Object
(
[StatusCode] => Error
[StatusMessage] => The SendableCustomObjectField is invalid.
[OrdinalID] => 0
[ErrorCode] => 310007
[NewID] => 0
[Object] => stdClass Object
I haven't found out a way to get around this error, or any working code samples in the FuelSdk repo or googling.
any ideas?
EDIT:
$this->_dataExtensions->columns = [
[
'Name' => 'customerKey',
'FieldType' => 'Text',
'IsPrimaryKey' => 'true',
'MaxLength' => '200',
'IsRequired' => 'true'
],
[
'Name' => 'firstName',
'FieldType' => 'Text',
'IsPrimaryKey' => 'no',
'MaxLength' => '50',
'IsRequired' => 'no'
],
[
'Name' => 'lastName',
'FieldType' => 'Text',
'IsPrimaryKey' => 'no',
'MaxLength' => '50',
'IsRequired' => 'no'
],
[
'Name' => 'primaryEmail',
'FieldType' => 'Text',
'IsPrimaryKey' => 'no',
'MaxLength' => '254',
'IsRequired' => 'no'
]
];