You need to sign in to do that
Don't have an account?
Sumant Kuchipudi
How to update LinkedEntityId in ContentDocumentLink ?
HI,
I need to pull the all ContentDocumentLink recrods related to All Contacts (30K) and update LinkedEntityId (related to Contact) with new custom object record ids. while updating ContentDocumentLink record I got below error
I need to pull the all ContentDocumentLink recrods related to All Contacts (30K) and update LinkedEntityId (related to Contact) with new custom object record ids. while updating ContentDocumentLink record I got below error
LinkedEntityIdUnable to create/update fields: LinkedEntityId. Please check the security settings of this field and verify that it is read/write for your profile or permission set.INVALID_FIELD_FOR_INSERT_UPDATEfalseI'm using python script to do this (but apex solution is also fine). please check below code
query_result = self.svc.query("select id from contact where Student__c=true and id='00336000014TJv9'") cnt=0 contList=[] while True: for row in query_result[self.sf.records:]: cnt+=1 contList.append(str(row[1])) if str(query_result[self.sf.done]) == 'true': break query_result = self.svc.queryMore(str(query_result[self.sf.queryLocator])) for con in contList: links = self.svc.query("select id,ContentDocumentid from ContentDocumentLink where LinkedEntityId = '"+str(con)+"' limit 1"); if (links!=None and len(links)>0): for link in links[self.sf.records:]: writer.writerow({'Contac_ID': str(con), 'Document_ID': str(link[3]),'Document_Linked_ID': str(link[1])}) emNotes = { 'type' : 'Em_Note__c', 'Contact__c' : str(con), 'Name' : str(link[3]) } results = self.svc.create(emNotes ) emNotesID= results[0] contentDocumentLink = { 'type' : 'ContentDocumentLink', 'id' : str(link[1]), 'LinkedEntityId' : str(emNotesID) } self.svc.update(contentDocumentLink); # I guess the error is herePlease advice
Complete code
I looked at your change that you are suggesting to use "con.id" but "con" is ID, it won't work.