1

The field is Nullable and I'm trying to hit

/data/v1/async/dataextensions/key:DE_NAME/rows

with attached items obj

const items = [
  {
    'Subscriber Key': SUBSCRIBER_KEY,
    'Date': null
  }
]

The same API hit with a non null date works.

const items = [
  {
    'Subscriber Key': SUBSCRIBER_KEY,
    'Date': new Date() // this is js
  }
]

API reference: https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/insertDataExtensionIDAsync.htm

  • Have you tried just excluding the field in your payload when you want it to be null? – Gortonington Sep 6 '19 at 20:40
  • @Gortonington Yes, if I exclude the field the value does not change from what it was before. – ehacinom Sep 6 '19 at 20:49
  • ah so you are looking to overwrite the existing value, not put in a brand new record. – Gortonington Sep 8 '19 at 14:39
2

I didn't have the async endpoints you listed above turned on in the account I was testing this on, so I have not been able to verify this is true in those endpoints as well. By using the hub dataevents endpoint (also available as async, but requires primary keys in the DE) I was able to overwrite the date with null (well, technically I believe it is 'empty' not null, but for most use cases in SFMC this would be equivalent) by just using an empty string in the passed value.

For instance:

Endpoint: /hub/v1/dataevents/key:{{myDEKey}}/rowset

Async Endpoint: /hub/v1/dataeventsasync/key:{{myDEKey}}/rowset

Payload:

[
    {
  "keys": {
    "SubscriberKey": "gortonington@gortonington.com"
  },
  "values": {
    "Name": "John Smith",
    "Date": ""
  }
}
]

This would take the original value of:

enter image description here

and replace it with:

enter image description here

Be aware that the sync endpoint will return what was posted (e.g. the payload would be the response), but the async endpoint will return an empty string "" regardless of success or failure. I assume this is because it is undocumented.

| improve this answer | |
  • 1
    that's what I ended up doing too. This is a good explanation. Salesforce should still take null values in the future though. – ehacinom Sep 9 '19 at 17:36
3


At this time there is no way to overwrite an existing Date value with a NULL using the REST API. I've been told the SOAP API does allow Updating to NULL - however I haven't tested it yet.

A work around could be to set the date to 1/1/1900, and run SSJS or SQL activities over the DataExtension to replace the fake date with a NULL.

| improve this answer | |

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.