• Charlie Bratches
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am trying to update a custom date field to a null value using ForceClient in .NET. Currently, it doesn't seem like it's possible to do this, even on optional Date fields. I've double-checked that the field is not required.

The way I understand it is, a Date field can accept a valid date string or null. But passing null causes the field not to update, it doesn't actually null out the field.

Code is something like this:
using (ForceClient sfClient = GetSfClient())
{
    SuccessResponse resp = null;
    try
    {
    	accountData.CustomDateField = null;
        resp = await sfClient.UpdateAsync("Account", accountId, accountData);
    }
    ...
}
"accountData" is an object containing all the fields we're updating on the account. Like I mentioned above, passing null for any of those fields just causes the field to not update. For a Date field, we get an error on anything besides a valid date format. So I've tried passing "null", empty string, white space, etc.

How can I null out a Date field, or any field for that matter?

Thank you for your help,
Charlie Bratches


 
I am trying to update a custom date field to a null value using ForceClient in .NET. Currently, it doesn't seem like it's possible to do this, even on optional Date fields. I've double-checked that the field is not required.

The way I understand it is, a Date field can accept a valid date string or null. But passing null causes the field not to update, it doesn't actually null out the field.

Code is something like this:
using (ForceClient sfClient = GetSfClient())
{
    SuccessResponse resp = null;
    try
    {
    	accountData.CustomDateField = null;
        resp = await sfClient.UpdateAsync("Account", accountId, accountData);
    }
    ...
}
"accountData" is an object containing all the fields we're updating on the account. Like I mentioned above, passing null for any of those fields just causes the field to not update. For a Date field, we get an error on anything besides a valid date format. So I've tried passing "null", empty string, white space, etc.

How can I null out a Date field, or any field for that matter?

Thank you for your help,
Charlie Bratches