1 answer
Hi Jonathan, You can try handling the validatio via trigger like below sample code :-
If this works, please mark it as best answer.trigger ContentVersionTrigger on ContentVersion (before delete) {
Set<Id> contentDocumentIdSet = new Set<Id>();
if(trigger.IsDelete){
for(ContentVersion con : Trigger.old){
if(con.ContentDocumentId != null)
{
contentDocumentIdSet.add(con.ContentDocumentId);
}
}
ContentDocumentLink cdl = [SELECT ContentDocumentId, LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId IN:contentDocumentIdSet Limit 1];
for(ContentVersion con : Trigger.old){
if(con.Dokumentenklasse__c =='Geschäftsbrief'){
if(cdl!=null){
con.addError('You cant edit the file');
}
}
}
}
}
Regards,
Priya Ranjan