1

I am using FuelSDK to send triggered emails using Salesforce Marketing Cloud (formerly ExactTarget). Here is an approximation of the code I'm using:

$triggeredsend = new ET_TriggeredSend();
$triggeredsend->authStub = $My_ET_Client;
$triggeredsend->props = array("CustomerKey" => 'MyTriggeredEmailID');
$triggeredsend->subscribers = array(
        array(
                "EmailAddress"  =>  'bob@example.com', 
                "SubscriberKey" => $subscriber_key, 
                "Attributes" => $some_attributes));
$results = $triggeredsend->send();

Amidst $some_attributes in my example is a Date type field (we'll call it My_Date) that contains a null value. However, I get this response from SFMC:

Error Code: 20 - Value provided for My_Date cannot be stored in a Date field.

I see that if I were using SoapClient, I "must explicitly state that null value using the NullAPIProperty type":

https://code.exacttarget.com/apis-sdks/soap-api/updating-a-data-extension-object-with-a-null-field-value.html

How do I send a NullAPIProperty type attribute using FuelSDK?

Thanks in advance,

Ben

EDIT: Here is a more complete dump of the query and results. To further address Mark's proposed answer: This code is meant to trigger a TriggeredSend and send the appropriate subscriber information. You'll see that one of the fields -- the one that is causing the error message -- needs to have a null value. The field itself is already nullable. This operation is distinct from updating the DataExtension field itself.


DEBUG - 2016-01-06 21:01:30 --> Preparing to send triggers...
DEBUG - 2016-01-06 21:01:31 --> ET_Post Object
(
    [status] => 
    [code] => 200
    [message] => 
    [results] => Array
        (
            [0] => stdClass Object
                (
                    [StatusCode] => Error
                    [StatusMessage] => Unable to queue Triggered Send request.  There are no valid subscribers.
                    [OrdinalID] => 0
                    [ErrorCode] => 180008
                    [NewID] => 0
                    [SubscriberFailures] => stdClass Object
                        (
                            [Subscriber] => stdClass Object
                                (
                                    [PartnerKey] => 
                                    [ObjectID] => 
                                    [EmailAddress] => bbirney@bbirney.com
                                    [Attributes] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [Name] => UserID
                                                    [Value] => 79
                                                )

                                        REDACTED

                                        [22] => stdClass Object
                                            (
                                                [Name] => Purchase_Date
                                                [Value] => 
                                            )

                                        REDACTED
                                    )

                                [SubscriberKey] => dev_79
                            )

                        [ErrorCode] => TriggeredSendSubscriberProcessingError
                        [ErrorDescription] => Error Code: 20 - Value provided for Purchase_Date cannot be stored in a Date field.
                    )

            )

    )

[request_id] => 
[moreResults] => 

)

1

Your question is specifically about the PHP FuelSDK, which I'm completely unfamiliar with so this is a shot in the dark.

It looks like you'll need to define an array specifically for the field that you're trying to null and add it to the collection.

$triggeredsend->subscribers = array(
        array(
                "EmailAddress"  =>  'bob@example.com', 
                "SubscriberKey" => $subscriber_key, 
                "Attributes" => $some_attributes,
                "SendableDataExtensionField" => array(
                    'Name' => 'My_Date',
                    'Value' => NULL
                )
            )
        );

Syntax information gleaned from here: http://howtoforge.answers.sc/salesforce/questions/33999/fuel-sdk-php-sendable-data-extension.html

  • Thanks for the input, Mark, but unfortunately this didn't work. The code you cited appears to be for managing Data Extensions (see "new ET_DataExtension()") rather than invoking triggers (new ET_TriggeredSend). I see that the author indicates that he is looking to set certain DataExtension fields to nullable, but I think that is a different operation than sending a null value on an attribute, which is the problem I'm running into. At any rate, adding the array values that you suggested did not produce a different result than the one I documented above. – Ben Birney Jan 7 '16 at 2:08
0

PHP has a NULL value that you can set nullable variables to, have you tried setting this attribute value to that? The example that you referenced above is for a .Net implementation, which is different than what your code is here.

$My_Date = NULL

When you say that the field is "Nullable" do you mean that the field is not required? Data Extension objects appear to have a IsRequired field by default. This apparently determines if a value has to be supplied or not.

Where is $some_attributes created?

  • I am already setting the 'Value' key to the PHP NULL value in the input array. I need to send an explicit null for the field in question, not simply omit it; I need to make sure it is not set at the SFMC end. Here is an example of how I set it: $inSFMCSubscriber->props['Attributes'][] = array('Name' =>self::SFMC_PURCHASE_DATE, 'Value' => $txn_date != null ? $txn_date->format('m/d/Y') : null); – Ben Birney Jan 8 '16 at 18:30

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.