5

I have come across an edge case where we need to set a field in our data extension to null that previously contained data. (Yes, the field is nullable :) )

I have found documentation on how to do this using SOAP, but have been unsuccessful using the REST API

This code is throwing a 400 with errorcode 10006:

fuel({
    method: 'PUT',
    url: 'https://www.exacttargetapis.com/hub/v1/dataevents/key:myKey/rowset',
    json: true,
    body: [{
          keys: {UserId: "myUserId"},
          values:{myNullableField: null}
    }]
}, function (error, request, body) {
    if(error){
        console.log("There was an error");
    } else {
        //handle response
   }
});

Any clues?

3
  • /Have you tried empty string, or would that not work for your case? Technically it's not null - so maybe not Nov 18, 2014 at 18:23
  • Empty string throws the same response as null. :-/
    – David
    Nov 18, 2014 at 19:15
  • Posting For @Bharath: Try setting the value to #N/A - might look odd but has worked for us in other Salesforce API's but have not tried on Salesforce Marketing cloud. Nov 18, 2014 at 19:53

3 Answers 3

1

This might be too little too late, but what you need is an array in your payload object of nullable fields. So

fuel({
    method: 'PUT',
    url: 'https://www.exacttargetapis.com/hub/v1/dataevents/key:myKey/rowset',
    json: true,
    body: [{
          fieldsToNull: [ "myNullableField" ],
          keys: {UserId: "myUserId"},
          values:{myNullableField: null}
    }]
}, function (error, request, body) {
    if(error){
        console.log("There was an error");
    } else {
        //handle response
   }
});
1
  • just tried this, it does not work Aug 21, 2018 at 20:18
0

I asked around, we're almost 100% sure you cannot do this via REST.

I've done a hacktastic workaround in times past. Redefine NULL to be some arbitrary value on the field that you will never use (like 83dahlkjli3hjal or 99999999999, etc). Make that the default value on the field. Then instead of resetting to NULL you would reset to 99999999999 or whatever you choose to be the new NULL.

You could also write a query activity to do it. Write an automation to upload the userId's, and run the query activity. You could do a combination of this with the first hack as well, setting all 99999999999's to NULL via query.

Sorry I don't have a better answer.

-1

I cannot add a comment as i do not have 50 points so posting this as an answer.

Try setting the value to #N/A - might look odd but has worked for us in other Salesforce API's but have not tried on Salesforce Marketing cloud.

3
  • Added it as a comment Nov 18, 2014 at 19:55
  • We can keep this as an answer for discussion's sake. Exact target is (still) another technogloy stack (salesforce purchased and is marketing it), it would suprise me that this salesforce "trick" would work for exacttarget. Nov 18, 2014 at 22:38
  • Unfortunately, this trick doesn't work for ET.
    – David
    Nov 21, 2014 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .