attachmentAV for Salesforce: Developer
You can integrate attachmentAV for Salesforce into your custom processes to scan files on-demand or process scan results with custom logic.
Submit file scans on-demand (#)
For ContentVersion, use the following Apex code:
new attachmentAV.AttachmentAVScanner().submitContentVersionScan(contentVersionId);
For Attachment, use the following Apex code:
new attachmentAV.AttachmentAVScanner().submitAttachmentScan(attachmentId);
What is happening under the hood:
- The logic submits the ContentVersion/Attachment for scanning.
- The scan is happening asynchronously. When the scan is completed, the
attachmentAV__ScanResult__c record
linked to the Attachment/ContentVersion object is updated with the scan result. - Scanning mitigation actions and notifications are executed.
If any error occurs, it will be logged in the attachmentAV__ScanResult__c.ProcessingError__c
field and the status of the attachmentAV__ScanResult__c
will be changed to Failed.
attachmentAV__ScanResult__c
records are linked to ContentVersion objects indirectly via the attachmentAV__ContentDocumentId__c
field and to Attachments via the attachmentav__AttachmentId__c
field.
Additionally, there is a field ContentVersion.attachmentAV__ScanResult__c
on the ContentVersion object which points to the scan result.
Receive scan results (#)
Scan results are published as platform events. See Publish platform event for details.