Create trigger on document object

Hello, I've been trying to create a record trigger on the document object as follows:

@RecordTriggerInfo(object = "document", name="document", events = {RecordEvent.BEFORE_INSERT, RecordEvent.BEFORE_UPDATE})

But when I import the vpk into Vault, I get the below error:

ERROR "[type=INVALID_DATA,message=Invalid object [document] specified in class annotation element [object]]"

Is it possible to create a trigger against the document object? If yes, how is this done?


Thank you




  • Avatar
    Kevin N

    Hi John,

    Triggers are not available on documents. The "document" data structure is a special "object" that is used for VQL, relationships, etc. It is not a standard Vault Object in which you create records; it is a reference to documents that exist in a vault.

    Vault Objects that can have triggers implemented are viewable in the UI or via the API (https://developer.veevavault.com/api/19.1/#retrieve-object-collection). These are objects were you directly create data records that can then initiate a BEFORE/AFTER trigger.

    Documents can currently only have Vault Java SDK code implemented via Document Actions.



  • Avatar
    John Choo

    Hi Kevin

    Thank you for your response, and the information regarding developing triggers in the Vault Java SDK. This is very helpful.

    I recently discovered "Event Actions" of the document lifecycle that includes a trigger for document creation. I was able to accomplish the requirement using this feature.



Please sign in to leave a comment.