I am getting issue in updating customer postal address.
Below in my method to updating customer postal address.
string addressLocationId = "000004773";
string company = "USMF";
string customerAccountNumber = "usmf_US-P010";
CustomerPostalAddress customerPostalAddress = _context.CustomerPostalAddresses.AddQueryOption("cross-company", "true").Where(x => x.DataAreaId == company &&
x.AddressLocationId == addressLocationId && x.CustomerAccountNumber == customerAccountNumber).FirstOrDefault();
DataServiceCollection<CustomerPostalAddress> dataServiceCollection = new DataServiceCollection<CustomerPostalAddress>(_context);
dataServiceCollection.Add(customerPostalAddress);
customerPostalAddress.AddressDescription = "Test address.";
DataServiceResponse response = null;
try
{
_context.UpdateObject(customerPostalAddress);
response = _context.SaveChanges(SaveChangesOptions.PostOnlySetProperties);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + ex.InnerException);
}
I am getting below error.
\"message\":\"No resources were found when selecting for update.\",
\"type\":\"Microsoft.Dynamics.Platform.Integration.Services.OData.ODataArgumentException\",\"stacktrace\":\"
at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.UpdateManager.GetEntityForUpdate(IQueryable query, EntityType entityType) ......