Clearing the property values of copied documents

When documents are copied, their property values are copied as well. This may be undesirable for some properties that you want the user to enter or that should be unique. To accomplish this, you need VBScript to react and clear the properties when documents are copied. A custom event procedure for the DocGenericEvent_BeforeNewDocument event is the ideal solution. This event occurs just before document copies are created, when you can set the property values that will be saved for the copies. If the properties are not used for all document types in the same vault, you can use a conditional statement to take the appropriate action for each document type as in the following example.

Sub DocGenericEvent_BeforeNewDocument(Batch, Action, SourceFile, DocType, DocTemplate)
    If Document.DocumentType.InternalName = "QualityDocument" Then
        Document.Category = "Quality Documents"
        Document.LastAuditBy = vbNullString
        Document.LastAuditOn = Null
        Document.AuditResult = vbNullString
        Document.AuditorNotes = vbNullString
        Document.NextAuditBy = vbNullString
        Document.NextAuditOn = Null
        Document.AuditHistory = vbNullString
        Document.Author = vbNullString
        Document.ApprovedBy = vbNullString
        Document.ApprovedOn = Null
        Document.Comments = vbNullString
    Else If Document.DocumentType.InternalName = "NonConformance" Then
        Document.Category = "Non Conformances"
    End If
End Sub

Note    Date properties do not accept string values. Therefore, instead of setting them to vbNullString, set them to Null.