You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using this configuration, create and delete is working fine. But when I want to update, child record always receive 400, and the reponse is like:
{
"body":[
{
"message":"Unable to create/update fields: parent_id. Please check the security settings of this field and verify that it is read/write for your profile or permission set.",
"errorCode":"INVALID_FIELD_FOR_INSERT_UPDATE",
"fields":[
"parent_id"
]
}
],
"httpHeaders":{
},
"httpStatusCode":400,
"referenceId":"a8le0000000IB31AAG"
}
So I guess SFDC won't allow me to update parent_id, and that's reasonable. The question is why this key-value pair is inserted into request, despite I already declare update field list contains only option.
After I looking at sdk code, I found in file SFParentChildrenSyncUpTarget.m line 417, there is code like this:
This will insert above key-value pair into the request body. But I think this is only required when creating, not updating. So I add one more condition:
if (parentId && isCreate) { // only insert when create
fields[((SFChildrenInfo *) info).parentIdFieldName] = useParentIdReference ? [NSString stringWithFormat:@"@{%@.%@}", parentId, kCreatedId] : parentId;
}
And it works like a charm.
How do you think?
please let me know. Thanks.
The text was updated successfully, but these errors were encountered:
It won't complain if you select "allow reparenting" in the master-detail relationship definition.
However, I see your point. Since reparenting is disallowed by default, the code should not be adding the parent id automatically during an update (and apps that want to reparent and allow it should be responsible for adding the parent id field in their children update list).
It is a behavior change so we will evaluate whether to do it in a minor release or not.
Mobile app and SFDC are managed by two separate teams, so if I want to change some configuration in SFDC I gotta have enough proof to persuade people, which as you can guess, most mobile developers don't. If we can have a workaround from SDK, many people's life will be easier.
Please fill out the following details:
Assume we have two classes "Parent" and "Child".
And my sync up configure file is like below:
Using this configuration, create and delete is working fine. But when I want to update, child record always receive 400, and the reponse is like:
Request body is like:
So I guess SFDC won't allow me to update
parent_id
, and that's reasonable. The question is why this key-value pair is inserted into request, despite I already declare update field list contains onlyoption
.After I looking at sdk code, I found in file
SFParentChildrenSyncUpTarget.m
line 417, there is code like this:This will insert above key-value pair into the request body. But I think this is only required when creating, not updating. So I add one more condition:
And it works like a charm.
How do you think?
please let me know. Thanks.
The text was updated successfully, but these errors were encountered: