You need to sign in to do that
Don't have an account?
Charlie Bratches
ForceClient Insert/Update null values
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:
How can I null out a Date field, or any field for that matter?
Thank you for your help,
Charlie Bratches
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
Sample Code - https://www.infallibletechie.com/2020/01/fieldstonull-in-salesforce-api-call.html
As per the example in the link you posted, I'm not able to instantiate an sObject using the Salesforce .Force assembly. Perhaps I'm missing a .dll file?
In the example code I posted, the "accountData" is a custom object we use to map our data to our custom fields.
I tried a solution like this:
When I add a string[] property to my accountData object called fieldsToNull and populate it with the name of my custom date field, I get the following error:
"No such column 'fieldsToNull' on sobject of type Account."
What am I missing? Any further help would be appreciated.