| | |
| | | trigger ContentDocumentLink on ContentDocumentLink (before insert,after insert,before delete) { |
| | | // 20231103 陈京武 Lightning文件修改 Start |
| | | if(StaticParameter.ContentDocumentLink == false){ |
| | | return; |
| | | } |
| | |
| | | Map<String,List<Id>> deleteImages = new Map<String,List<Id>>(); |
| | | // sx 20230210end 备品借出申请故障报告附件提取 |
| | | Set<Id> docidList = new Set<Id>(); |
| | | Set<Id> delDocidList = new Set<Id>(); |
| | | if (Trigger.isBefore && Trigger.isInsert) { |
| | | for (ContentDocumentLink link : Trigger.new) { |
| | | if(String.valueOf(link.LinkedEntityId).startsWith(System.Label.Oppor_sepKey)){ |
| | |
| | | if (Trigger.isAfter && Trigger.isInsert) { |
| | | for (ContentDocumentLink link : Trigger.new) { |
| | | docidList.add(link.ContentDocumentId); |
| | | } |
| | | } |
| | | if(Trigger.isDelete && Trigger.isBefore){ |
| | | for (ContentDocumentLink link : Trigger.old) { |
| | | docidList.add(link.ContentDocumentId); |
| | | delDocidList.add(link.ContentDocumentId); |
| | | } |
| | | } |
| | | ContentVersion ver = new ContentVersion(); |
| | |
| | | if (accIds.size() > 0) { |
| | | Map<String, String> attMap = new Map<String, String>(); |
| | | // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accIds order by ParentId]; |
| | | List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accIds order by LinkedEntityId]; |
| | | List<ContentDocumentLink> linkList = [select ContentDocumentId,LinkedEntityId from ContentDocumentLink where ContentDocument.FileType != 'SNOTE' and LinkedEntityId =: accIds order by LinkedEntityId]; |
| | | System.debug('客户Link的条数:' + linkList.size()); |
| | | for (ContentDocumentLink link : linkList) { |
| | | if(!delDocidList.contains(link.ContentDocumentId)){ |
| | | attMap.put(link.LinkedEntityId, link.LinkedEntityId); |
| | | } |
| | | } |
| | | System.debug('attMap的条数:' + attMap); |
| | | List<Account> updAccList = new List<Account>(); |
| | | |
| | | //20221207 lt 医院审批优化 start |
| | |
| | | } |
| | | } |
| | | acc.Is_upload_file__c = attMap.containsKey(accid); |
| | | System.debug('是否上传附件:' + attMap.containsKey(accid)); |
| | | updAccList.add(acc); |
| | | } |
| | | } |
| | |
| | | if (accAppIds.size() > 0) { |
| | | Map<String, String> attMap = new Map<String, String>(); |
| | | // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accAppIds order by ParentId]; |
| | | List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accAppIds order by LinkedEntityId]; |
| | | List<ContentDocumentLink> linkList = [select ContentDocumentId,LinkedEntityId from ContentDocumentLink where ContentDocument.FileType != 'SNOTE' and LinkedEntityId =: accAppIds order by LinkedEntityId]; |
| | | for (ContentDocumentLink link : linkList) { |
| | | if(!delDocidList.contains(link.ContentDocumentId)){ |
| | | attMap.put(link.LinkedEntityId, link.LinkedEntityId); |
| | | } |
| | | } |
| | | List<Account_Delay_Apply__c> updAccAppList = new List<Account_Delay_Apply__c>(); |
| | | |
| | |
| | | } |
| | | try { |
| | | System.debug('客户变更申请'); |
| | | if (updAccAppList.size() > 0) update updAccAppList; |
| | | if (updAccAppList.size() > 0){ |
| | | StaticParameter.ContentDocumentTrigger = false; |
| | | update updAccAppList; |
| | | } |
| | | } catch (Exception e) { |
| | | linkList[0].addError(e.getMessage()); |
| | | } |
| | |
| | | |
| | | Map<String, String> attMap = new Map<String, String>(); |
| | | // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :specIds order by ParentId]; |
| | | List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: specIds order by LinkedEntityId]; |
| | | List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where ContentDocument.FileType != 'SNOTE' and LinkedEntityId =: specIds order by LinkedEntityId]; |
| | | for (ContentDocumentLink link : linkList) { |
| | | attMap.put(link.LinkedEntityId, link.LinkedEntityId); |
| | | } |
| | |
| | | // DB202304087063 SFDC系统附件上传自动通知功能开发需求 end |
| | | |
| | | |
| | | |
| | | // 20231103 陈京武 Lightning文件修改 End |
| | | |
| | | } |