1

I have been trying to create a DataExtention using the FuelSDK.

I followed this example

https://github.com/salesforce-marketingcloud/FuelSDK-PHP/blob/master/objsamples/sample-sendable-dataextension.php

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'
                ]
            ];
  • Does the DE have a field with the name 'EmailAddress'? – EazyE Aug 2 '19 at 17:45
  • I also don't see where you are defining field names – EazyE Aug 2 '19 at 17:47
  • i updated with my column definitions – Eli Aug 2 '19 at 19:02
1

From this help doc: 'Create a Data Extension'

the php example

$newde->SendableDataExtensionField = new Marketing Cloud_DataExtensionField();                           
$newde->SendableDataExtensionField->Name = 'EMAIL';

your SendableDataExtensionField should have a value of a field in your DE so for your example it should have the value of customerKey

I believe for the FuelSDK you need this line from the doc you included

postDE->props["SendableCustomObjectField"]->props["Name"] = "customerKey";

0

In your example DE columns, you have a column named 'primaryEmail' and 'customerKey'. In your DE creation here:

 'SendableDataExtensionField' => ['Name' => 'EmailAddress', 'Value' => 'primaryEmail'],
        'SendableSubscriberField'    => ['Name' => 'Subscriber Key', 'Value' => 'CustomerKey'],

You have specified that name of the columns as 'EmailAddress' and 'Subscriber Key' which do not match you example DE column names.

Try modifying these to match the names of the columns you have specified in creation. The values you have provided are there to allow specifying a default value for the column -- it looks as thought you are under the impression they are for specifying the column name.

Try:

 'SendableDataExtensionField' => ['Name' => 'primaryEmail'],
        'SendableSubscriberField'    => ['Name' => 'customerKey'],
        ]

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.