We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I'm using the example code to update an object. The object has an id and some properties, just like this:
@JsonIgnoreProperties(ignoreUnknown=true) public static class MyObject { @JsonProperty(value="Id") private String id; @JsonProperty(value="some_property__c") private String some_property__c; public String getId() {return id;} public void setId(String Id) {this.id = Id;} public String getSome_property__c() {return some_property_c;} public void setSome_property__c(String some_propery__c) {this.some_property__c = some_property__c;} }
When I try to change the property, my program fails:
final String query = "SELECT id, some_property__c FROM sometable"; QueryResult<MyObject> result = api.query(query, MyObject.class); for (MyObject mo : result.getRecords()) { mo.setSome_property__c("some value"); api.updateSObject("sometable", mo.getId(), mo); }
The error message of the API with HTTP status code 400 (bad request) ist:
[ { "message": "The Id field should not be specified in the sobject data.", "errorCode": "INVALID_FIELD" } ]
The Java error is:
INFO com.force.api.http.Http - Bad response code: 400 on request: POST https://myinstance.my.salesforce.com/services/data/v39.0/sobjects/sometable/thealphanumerickey?_HttpMethod=PATCH Accept: application/json Content-Type: application/json Authorization: Bearer ... {"Id":"thealphanumerickey","some_property__c":"some value"}
And in fact, as soon as I modify the request body, so that it does not contain the id, it works fine.
API version is 39.0
The text was updated successfully, but these errors were encountered:
We just had the same issue.
As a workaround, we set the id to null before calling the updateSObject and it works fine: mo.setId(null);
Sorry, something went wrong.
No branches or pull requests
Hi,
I'm using the example code to update an object. The object has an id and some properties, just like this:
When I try to change the property, my program fails:
The error message of the API with HTTP status code 400 (bad request) ist:
The Java error is:
And in fact, as soon as I modify the request body, so that it does not contain the id, it works fine.
API version is 39.0
The text was updated successfully, but these errors were encountered: