+ Start a Discussion
Shyam Sundar 84Shyam Sundar 84 

Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, invalid parent id: [ParentId] Error is in expression '{!createOffer1}' in page offermatrix: Class.offerExtension.createOffer1: line 329, column 1

326:  offer__Share offerShare=new offer__Share();     327:offerShare.userorgroupid =[Select id from user where id=:userinfo.getuserid()].id;  
   328: offerShare.AccessLevel = 'Edit';    
    329: insert offershare; 
Navin Selvaraj23Navin Selvaraj23
hi Shyam,

UserInfo.getUserID() returns the same result where you have put a query. Also, 
First check is Account is private in your organisation then only you will get AccountShare object.

Some more limitation on this field:
You cannot update ParentId field on the offerShare Object. To update a offershare records and add new ParentId , You need to delete the existing offerShare records and create new one.

Radhika ChRadhika Ch
Hi Shyam,
You need to pass the Recordid as the parentId.