Attachment Policies

Attachment policies provide places where you can hook in behaviors that trigger when attachments are read, created, updated or deleted against a node.

Unlike other policy handlers, these will only fire at the instance when an attachment is created, updated, or deleted, and will not fire upon a branch merge or release.

When configuring your attachments, you can specify an attachment ID you wish to fire your policy. For example, suppose you are configuring a webhook rule that you only want to fire when the default attahchment is updated. In this case, you can specify the "default" key for your attachment policy to have it only fire for default, and not some other attachment id. If you do not specify an attachment ID, the rule will fire for all attachent ids, except for those beginning with _preview_, which we exclude since these are system generated attachments.

The following policies are available:

Policy QName Description
p:beforeReadAttachment Raised before a node's attachment is read
p:afterReadAttachment Raised after a node's attachment is read
p:beforeCreateUpdateAttachment Raised before an node's attachment is added to a node (either created or updated)
p:afterCreateUpdateAttachment Raised after an node's attachment is added to a node (either created or updated)
p:beforeDeleteAttachment Raised before an attachment is deleted from a node
p:afterDeleteAttachment Raised after an attachment is deleted from a node

Method Signatures

The following method signatures apply for the policies mentioned above:


function beforeReadAttachment(node, attachmentId);

public void beforeReadAttachment(Node node, String attachmentId);


function afterReadAttachment(node, attachmentId);

public void afterReadAttachment(Node node, String attachmentId);


function beforeCreateUpdateAttachment(node, attachmentId, contentType, filename);

public void beforeCreateUpdateAttachment(Node node, String attachmentId, String contentType, String filename);


function afterCreateUpdateAttachment(Node node, Attachment attachment);

public void afterCreateUpdateAttachment(Node node, Attachment attachment);


function beforeDeleteAttachment(node, attachment);

public void beforeDeleteAttachment(Node node, Attachment attachment);


function afterDeleteAttachment(node, attachment);

public void afterDeleteAttachment(Node node, Attachment attachment);