Confirmation Pages for Copy Document with References

The following use case is supported by this configuration:

  • Drawing documents can have references to documents with Document Type ‘Object’.

  • When the drawing is copied with references, it depends on the purpose of the copy whether the referenced objects should also be copied.

  • When during copying a referenced document with Document Type ‘Object’ is encountered, the user will be asked whether objects should also be copied.

  • If another referenced document with Document Type ‘Object’ is encountered, the answer that the user entered will be reused.

Configuration

You can download the configuration which implements this use case here. This configuration does not depend on any external components. It can be imported into an empty Vault and will be fully functional.

Helper Functions

Prepare for processing a document (repeated for each document)

Functionality implemented:

  1. Check if document to be copied has the Document Type ‘Object’.

  2. If so, check if a document with Document Type ‘Object’ was encountered before.

  3. If not, set up a confirmation to copy objects or not.

Copy
Sub DocCopyMoveEvent_PreBeforeCopyWithReferences(Batch, OldParentDocument, NewParentDocument, TargetFolder)
    If Document.DocumentType.InternalName = "Object" Then
        If Not Batch.Argument ("OBJFound") Then
            Batch.AskConfirmation "CONF_CopyObject", "Do you want to also copy the objects?", AS_CDV_NO, AS_COMMENT_NONE
            Batch.Argument ("OBJFound") = True
        End If
    End If
End Sub

This confirmation appears in the user interface as follows:

Processing a document (repeated for each document)

Functionality implemented:

  1. Check if objects should not be copied.

  2. If not, check if document to be copied has the Document Type ‘Object’.

  3. If so, fail the copy of the current document.

Copy
Sub DocCopyMoveEvent_BeforeCopyWithReferences(Batch, OldParentDocument, NewParentDocument, TargetFolder)
    If GetConfirmation (Batch, "CONF_CopyObject", AS_CDV_NO) = AS_CDV_NO Then
        If Document.DocumentType.InternalName = "Object" Then
            Batch.FailCurrent "Object not copied."
        End If
    End If
End Sub