You need to sign in to do that
Don't have an account?
S Balaji 8
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY
For the following code i am getting insert failed exception on insert contentList; Can someone help me with this , it is working on one sandbox but failing in another one
@isTest public static void sendemailtoAccountownerTest(){
Test.startTest();
//Create Document Parent Record
Account acc =new Account();
acc.Name = 'Test Account';
acc.BillingCountryCode = 'CA';
insert acc ;
//Create Document
ContentVersion cv = new ContentVersion();
cv.Title = 'Test Document';
cv.PathOnClient = 'TestDocument.pdf';
cv.VersionData = Blob.valueOf('Test Content');
cv.IsMajorVersion = true;
Insert cv;
//Get Content Documents
Id conDocId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:cv.Id].ContentDocumentId;
system.debug('conDocId data is :'+conDocId);
bynder__Bynder_Asset__c bynder = new bynder__Bynder_Asset__c();
bynder.bynder__File_Type__c = 'DOCUMENT';
bynder.bynder__Asset_Id__c = 'Test';
insert bynder;
//Create ContentDocumentLink
List<ContentDocumentLink> contentList = new List<ContentDocumentLink>();
ContentDocumentLink cdl = New ContentDocumentLink();
cdl.LinkedEntityId = acc.Id;
cdl.ContentDocumentId = conDocId;
cdl.shareType = 'V';
contentList.add(cdl);
ContentDocumentLink cdl1 = New ContentDocumentLink();
cdl1.LinkedEntityId = bynder.Id;
cdl1.ContentDocumentId = conDocId;
cdl1.shareType = 'V';
contentList.add(cdl1);
system.debug('Content list data is :' + contentList);
insert contentList;
bynder.bynder__Content_Version_Id__c = contentList[0].Id;
update bynder;
MOD_ContentDocumentLinkTriggerHelper.sendEmailToAccountOwner(contentList);
Test.stopTest();
}
@isTest public static void sendemailtoAccountownerTest(){
Test.startTest();
//Create Document Parent Record
Account acc =new Account();
acc.Name = 'Test Account';
acc.BillingCountryCode = 'CA';
insert acc ;
//Create Document
ContentVersion cv = new ContentVersion();
cv.Title = 'Test Document';
cv.PathOnClient = 'TestDocument.pdf';
cv.VersionData = Blob.valueOf('Test Content');
cv.IsMajorVersion = true;
Insert cv;
//Get Content Documents
Id conDocId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:cv.Id].ContentDocumentId;
system.debug('conDocId data is :'+conDocId);
bynder__Bynder_Asset__c bynder = new bynder__Bynder_Asset__c();
bynder.bynder__File_Type__c = 'DOCUMENT';
bynder.bynder__Asset_Id__c = 'Test';
insert bynder;
//Create ContentDocumentLink
List<ContentDocumentLink> contentList = new List<ContentDocumentLink>();
ContentDocumentLink cdl = New ContentDocumentLink();
cdl.LinkedEntityId = acc.Id;
cdl.ContentDocumentId = conDocId;
cdl.shareType = 'V';
contentList.add(cdl);
ContentDocumentLink cdl1 = New ContentDocumentLink();
cdl1.LinkedEntityId = bynder.Id;
cdl1.ContentDocumentId = conDocId;
cdl1.shareType = 'V';
contentList.add(cdl1);
system.debug('Content list data is :' + contentList);
insert contentList;
bynder.bynder__Content_Version_Id__c = contentList[0].Id;
update bynder;
MOD_ContentDocumentLinkTriggerHelper.sendEmailToAccountOwner(contentList);
Test.stopTest();
}
Can you specify on which line you are facing the error so can suggest based on it.
Thanks,