function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ClariusClarius 

Unable to update salesforce records using Remote Access - REST API

When logging in using OAuth as a standard user, any attempt to update salesforce fields using the Remote Access REST API fails with the following:

 

Salesforce is giving response 400 which means "Bad Request". The body of the response has "

{"message"=>"insufficient access rights on cross-reference id", "errorCode"=>"INSUFFICIENT_ACCESS"}

 

Updating works fine when logged in as a user with Administrator privileges.

 

Shivaji SShivaji S

This error could be for one of several reasons: A record that you are referencing has been deleted or does not exists or id you are using might be incorrect or a referenced record exists but is not shared with the record owner or the user you are using for oAuth.

Shivaji SShivaji S

And I would also suggest you to check the Field level security for all the lookup/relationship fields before you fire API.

 

Thanks,

Shivaji S

ClariusClarius

The exact same user can do the same update without problem on sfdc web console. For API access, the URL (with Authorization header) I am using is 

 

<server>/services/data/v26.0/sobjects/Opportunity/Id/<object id>

method : PATCH

Body : {"Amount":"100000"}

 

Why should salesforce send 400 response (meaning bad request) and say access "insufficient access rights on cross-reference id" for the same request ? I am not updating any field that has a cross reference id. This also happens for the objects owned and created by logged in user. 

 

The user has Standard User profile, if "System Administrator" is granted or "Modify All" permission on Opportunity Object is given to user, the same call above goes thu fine and updates the object.

 

Its very puzzling to see difference in behaviour between webconsole and REST API. Any help is highly appreciated.

SFGSFG
I have this same issue - like exactly the same - fif anyone ever figure this out?