You need to sign in to do that
Don't have an account?
Soundar Rajan Ponpandi
FIELD_INTEGRITY_EXCEPTION, Parent ID: id value of incorrect type: a0g0C000001NvFxQAK: [ParentId]
Hi,
I am trying to share a custom quote record to user's. But i am facing following error.
This Record is having "Control By Parent" access.
Even i tried with opportunity as a parentId.
Can you please tell me where i did a mistake and how can i achieve it in a success way.
Many Thanks in Advance.
Soundar Rajan P.
I am trying to share a custom quote record to user's. But i am facing following error.
This Record is having "Control By Parent" access.
Even i tried with opportunity as a parentId.
DEBUG|Exception -System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Parent ID: id value of incorrect type: a0g0C000001NvFxQAK: [ParentId]
Can you please tell me where i did a mistake and how can i achieve it in a success way.
public class GD_CreateQuoteTeam { @AuraEnabled public static void saveQuoteTeam(List<GD_Quote_Team__c> teamList, string quoteId){ try{ list<GD_Quote_Team__c> qtTeamList = new list<GD_Quote_Team__c>(); list<GD_Quote_Team__Share> readShareList = new list<GD_Quote_Team__Share>(); list<GD_Quote_Team__Share> editShareList = new list<GD_Quote_Team__Share>(); for(GD_Quote_Team__c team : teamList){ team.GD_Quotes__c = quoteId; qtTeamList.add(team); } Insert qtTeamList; /*Share Record - Read Only*/ for(gd_quote_Team__c qTeam : [select id,name,GD_user__c from gd_quote_Team__c where GD_Quotes__c =: quoteId and GD_Quote_access__c = 'Read Only']){ GD_Quote_Team__Share shareRecord = new GD_Quote_Team__Share(); shareRecord.AccessLevel = 'Read'; shareRecord.UserOrGroupId = qTeam.GD_user__c; shareRecord.ParentId = quoteId; readShareList.add(shareRecord); } if(readShareList.size()>0){insert readShareList;} /*Share Record - Read/Write*/ for(gd_quote_Team__c qTeam : [select id,name,GD_user__c from gd_quote_Team__c where GD_Quotes__c =: quoteId and GD_Quote_access__c = 'Read/write']){ GD_Quote_Team__Share shareRecord = new GD_Quote_Team__Share(); shareRecord.AccessLevel = 'edit'; shareRecord.UserOrGroupId = qTeam.GD_user__c; shareRecord.ParentId = quoteId; editShareList.add(shareRecord); } if(editShareList.size()>0){insert editShareList;} }catch(Exception e){system.debug('Exception -' + e);} } }
Many Thanks in Advance.
Soundar Rajan P.
As mentioned in the error can you try checking if the id that is mentioned is correct??
Regards,
Anutej
All Answers
As mentioned in the error can you try checking if the id that is mentioned is correct??
Regards,
Anutej
as i mentioned in the coding line no 18 & 27 " shareRecord.ParentId = quoteId;" i have provided quoteId as parent. I thing quote is the parent of this Quote_Team__c object.
Which id i need to pass here ? (Quote Id only ?)
Regards,
Soundar.
You are correct ! By mistake i have provided a quote id instead of opportunity ID. Because if any record under the Opportunity that's directly don't have a permission to share. Those records basically controlled by parent, Here parent is opportunity. So Obviously we should share the opportunity records as well.
I have changed my code and trying to share opportunity record but i am facing following Error (In sufficient Access)
Modified Code
Many Thanks for your support.
Soundar Rajan P.
I have fixed this issue.
in line No 31 also i did mistake (now provided a Opportunity Id instead of quote Id).
Thanks for your valuable support. I will mark your reply as best answer.
Regards,
Soundar.