You need to sign in to do that
Don't have an account?
Lakshmi Palnati
Unable to publish any Library as getting error message related to triggers.
Hi,
I am trying to upload a file from Library and getting below error message:
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger IntranetContents_ShareWithOtherLibrary caused an unexpected exception, contact your administrator: IntranetContents_ShareWithOtherLibrary: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Class.Content_Sharing_Required_Readings.createRequiredReadingSharRecords: line 21, column 1".
Any suggestions?
Thanks in advance.
I am trying to upload a file from Library and getting below error message:
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger IntranetContents_ShareWithOtherLibrary caused an unexpected exception, contact your administrator: IntranetContents_ShareWithOtherLibrary: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Class.Content_Sharing_Required_Readings.createRequiredReadingSharRecords: line 21, column 1".
Any suggestions?
Thanks in advance.
Best.
This trigger fires when contentversion Upload/update (its 205 lines of code,Just pasted till line 21).
trigger IntranetContents_ShareWithOtherLibrary on ContentVersion (after update,before update) {
set<ID> contentDocuments = new Set<ID>();
Set<ID> documentIds = new Set<ID>();
map<Id, ContentVersion> createReadingRecordsNewMap;
map<Id, ContentVersion> createReadingRecordsOldMap;
set<String> teams = new set<String>();
static final list<String> masterLibrariesNames = new list<String>{'*VX Master','*VX Master Secure'};
//get *VX Master and *VX Master Secure libraries
map<Id,ContentWorkspace> contentsDir = new map<Id,ContentWorkspace>([Select ID from ContentWorkspace Where Name in:masterLibrariesNames]);
if(contentsDir.size() > 0){
for(ContentVersion ver : trigger.new){
documentIds.add(ver.ContentDocumentId);
}
for(ContentWorkspaceDoc workspace : [Select Id,ContentDocumentId From ContentWorkspaceDoc
Where ContentDocumentId IN :documentIds AND ContentWorkspaceId in: contentsDir.keySet()]){
contentDocuments.add(workspace.ContentDocumentId);
}
}
------------------------
Even When deleting the file from content detail page getting similar error message:
trigger IntranetRemoveRequiredReadings on ContentDocument (after delete) {
list<Intranet_Required_Reading__c> deletedRRRecordsList = new list<Intranet_Required_Reading__c>();
Set<ID> ContentVersionIDs = new Set<ID>();
for(ContentDocument conDoc:trigger.old){
ContentVersionIDs.add(conDoc.LatestPublishedVersionId);
}
for(Intranet_Required_Reading__c RRRecord : [select Id from Intranet_Required_Reading__c where ContentVersionID__c in:ContentVersionIDs]){
deletedRRRecordsList.add(RRRecord);
}
if(!deletedRRRecordsList.isEmpty()){
delete deletedRRRecordsList;
}
}
Thanks in advance!