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
mukesh guptamukesh gupta 

Task field update by API

Hi Expert,

I have a custom field on Task object, and now i want to update task by API. i have tried to update by Postman, but facing error.
 
{
        "message": "insufficient access rights on object id",
        "errorCode": "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY",
        "fields": []
    }

 Please suggest

Regards
Mukesh
vishal-negandhivishal-negandhi

Hi Mukesh, 

This means you don't have access to Edit tasks. What profile are you using ? Check if you have "Edit Tasks" enabled on the profile. 

AnudeepAnudeep (Salesforce Developers) 
Like Vishal has explained above  INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, is a common issue when you try to update or create data with insufficient access on a record.

Kindly check the user profile and check whether the user has access to insert/update that record. Even if the user has access, kindly check whether the user has access to update fields like record types, lookup field, master-detail field, etc.

An easy way to identify if the user has access or not is by running a SOQL query on UserRecordAccess object
 
SELECT RecordId, HasReadAccess, HasTransferAccess, MaxAccessLevel
     FROM UserRecordAccess
     WHERE UserId = [single ID]
     AND RecordId = [single ID]      //or Record IN [list of IDs]

Troubleshooting steps:

1. Make sure whether the user have access to record ids of the lookup fields and/or master-detail fields in the record.
2. Check the user Profile(CRUD Permissions).
3. Profile need to have access for the record types.
4. Record's OwnerId automatically gets share record when the record is inserted. If the apex code try to create the same(Share record for the owner) explicitly. This error occurs.