Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for UpdateAsync to push null values to Salesforce. #376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/ForceToolkitForNET/ForceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ public Task<SuccessResponse> UpdateAsync(string objectName, string recordId, obj
return _jsonHttpClient.HttpPatchAsync(record, string.Format("sobjects/{0}/{1}", objectName, recordId));
}

public Task<SuccessResponse> UpdateAsync(string objectName, string recordId, object record, bool ignoreNull)
{
if (string.IsNullOrEmpty(objectName)) throw new ArgumentNullException("objectName");
if (string.IsNullOrEmpty(recordId)) throw new ArgumentNullException("recordId");
if (record == null) throw new ArgumentNullException("record");

return _jsonHttpClient.HttpPatchAsync(record, string.Format("sobjects/{0}/{1}", objectName, recordId), ignoreNull);
}

public Task<SuccessResponse> UpsertExternalAsync(string objectName, string externalFieldName, string externalId, object record)
{
if (string.IsNullOrEmpty(objectName)) throw new ArgumentNullException("objectName");
Expand Down
1 change: 1 addition & 0 deletions src/ForceToolkitForNET/IForceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public interface IForceClient : IDisposable
Task<SuccessResponse> CreateAsync(string objectName, object record);
Task<SaveResponse> CreateAsync(string objectName, CreateRequest request);
Task<SuccessResponse> UpdateAsync(string objectName, string recordId, object record);
Task<SuccessResponse> UpdateAsync(string objectName, string recordId, object record, bool ignoreNull);
Task<SuccessResponse> UpsertExternalAsync(string objectName, string externalFieldName, string externalId, object record);
Task<SuccessResponse> UpsertExternalAsync(string objectName, string externalFieldName, string externalId, object record, bool ignoreNull);
Task<bool> DeleteAsync(string objectName, string recordId);
Expand Down