How to configure callback hooks/events?
A custom JavaScript file that registers callback hooks/events must be available in the file extensibility.json in the folder conf in the directory applicationservice in the s3 bucket. The sample code to register an event is as follows: (Purpose: Prevent check-in in collection.)
window.CallbackService.registerCallback(“BEFORE_SAVE_SUBMIT”,
(data) => {
console.log(“BEFORE_SAVE_SUBMIT”, data);
if (data.assetInfo.collectionId === 1) {
window.alert(“Not allowed”);
return false;
}
});
Download sample for callback hooks.
The following events are available in Workspace:
BEFORE_SAVE_SUBMIT
Triggers before asset/folder checkin
Event data:- assetInfo: CheckinEventData – user modifiable
- isFolder: boolean – readOnly
- assetId: number – readOnly
Return { assetInfo } to update payload or false to cancel the event
AFTER_SAVE_SUBMIT
Triggers after asset/folder checkin
Event data:- files: Set
– Set of files checked in - assetInfo: CheckinEventData
- isFolder: boolean – isFolder or not
- assetIds: number[] – Updated/Created Asset ids
- collectionIds: number[] – Created Collection ids
- assetId: number – Asset Id – only applicable for save resvision.
- attributes: Object – Attributes – only applicable for save resvision.
- files: Set
BEFORE_ASSET_DETAIL_ACTION
Triggers before asset details open like info/detail
Event data:- entity: Entity – Entity of Asset
- assetId: number – Asset Id
- tabId: string – Id of the tab to be opened
- actionId: string – Id of the action
Return false to cancel the event
BEFORE_ASSET_PREVIEW_ACTION
Triggers before asset preview action
Event data:- entity: Entity – Entity of Asset
- assetId: number – Asset Id
- tabId: string – Id of the tab to be opened
- actionId: string – Id of the action
Return false to cancel the event
BEFORE_ASSET_LINKS_ACTION
Triggers before asset links/refernces action
Event data:- entity: Entity – Entity of Asset
- assetId: number – Asset Id
- tabId: string – Id of the tab to be opened
- actionId: string – Id of the action
Return false to cancel the event
BEFORE_ASSET_PROPERTIES_ACTION
Triggers before asset properties action
Event data:- entity: Entity – Entity of Asset
- assetId: number – Asset Id
- tabId: string – Id of the tab to be opened
- actionId: string – Id of the action
Return false to cancel the event
BEFORE_COLLECTION_DETAIL_ACTION
Triggers before collection details
Event data:- entity: Entity – Entity of Collection
- collectionId: number – Collection Id
Return false to cancel the event
BEFORE_PUBLISH_ASSET_ACTION
Triggers before asset publish action
Event data:- entity: Entity – Entity of Asset
Return false to cancel the event
BEFORE_PUBLISH_ASSET_SUBMIT
Triggers before asset submit/done for publishing
Event data:- entity: Entity – Entity of Asset
- publishingChannels: object[] – Information about selected publishing channels
Return { entity, publishingChannels } to update payload or false to cancel the event
AFTER_PUBLISH_ASSET_SUBMIT
Triggers after asset published successfully
Event data:- entity: Entity – Entity of Asset
- downloadInfo: object[] – Information about published content like downloadUrl.
BEFORE_SAVE_REVISION_ACTION
Triggers before save revision action
Event data:- entity: Entity – Entity of Asset
Return false to cancel the event
BEFORE_SAVE_REVISION_SUBMIT
Triggers before save revision submit/done
Event data:- assetId: number – Asset Id
- attributes: object – Contains attributes information
Return { attributes } to update payload or false to cancel the event
BEFORE_EDIT_ASSET_ACTION
Triggers before asset checkout/edit action
Event data:- assetId: number – Asset Id
- contentType: string – Content Type of Asset
- entity: Entity – Entity of Asset
Return false to cancel the event
AFTER_EDIT_ASSET_ACTION
Triggers after asset checkout/edit action
Event data:- assetId: number – Asset Id
- contentType: string – Content Type of Asset
- entity: Entity – Entity of Asset
- editDirectly: boolean – Whether the asset is checkedout directly or in context of document
BEFORE_DOWNLOAD_ASSET_ACTIO
Triggers before asset download action
Event data:- assetIds: number[] – Asset Ids
Return false to cancel the event
AFTER_DOWNLOAD_ASSET_ACTION
Triggers after asset download action
Event data:- assetIds: number[] – Asset Ids
- downloadUrl: string – Url to download asset
BEFORE_DISCARD_ASSET_ACTION
Triggers before asset cancel checkout/discard action
Event data:- entities: Entity[] – Array of Entity objects
OR - assetInfo: Object – Asset Info
Return false to cancel the event
- entities: Entity[] – Array of Entity objects
AFTER_DISCARD_ASSET_ACTION
Triggers after asset cancel checkout/discard action
Event data:- entities: Entity[] – Array of Entity objects
- assetInfo: Object – Asset Info
BEFORE_REINDEX_ASSET_ACTION
Triggers before asset redindex action
Event data:- assetInfos: Object[] – Asset Infos
Return false to cancel the event
AFTER_REINDEX_ASSET_ACTION
Triggers after asset redindex action
Event data:- assetInfos: Object[] – Asset Infos
BEFORE_DELETE_ASSET_ACTION
Triggers before asset delete action
Event data:- entities: Entity[] – Array of Entity objects
Return false to cancel the event
BEFORE_DELETE_ASSET_SUBMIT
Triggers before asset delete submit/done
Event data:- entities: Entity[] – Array of Entity objects
Return false to cancel the event
AFTER_DELETE_ASSET_SUBMIT
Triggers after asset delete submit/done
Event data:- entities: Entity[] – Array of Entity objects
BEFORE_DELETE_COLLECTION_ACTION
Triggers before collection delete action
Event data:- entity: Entity – Collection Entity object
Return false to cancel the event
BEFORE_DELETE_COLLECTION_SUBMIT
Triggers before collection delete submit/done
Event data:- entity: Entity – Collection Entity object
Return false to cancel the event
AFTER_DELETE_COLLECTION_SUBMIT
Triggers after collection delete submit/done
Event data:- entity: Entity – Collection Entity object
BEFORE_MOVE_COLLECTION_ACTION
Triggers before collection move action
Event data:- entities: Entity[] – Array of Entity objects
Return false to cancel the event
BEFORE_MOVE_COLLECTION_SUBMIT
Triggers before collection move submit/done
Event data:- sourceCollectionIds: number[] – Array of source collection ids
- targetParentCollectionId: number – Target collection id
Return false to cancel the event
AFTER_MOVE_COLLECTION_SUBMIT
Triggers after collection move submit/done
Event data:- sourceCollectionIds: number[] – Array of source collection ids
- targetParentCollectionId: number – Target collection id
BEFORE_COPY_COLLECTION_ACTION
Triggers before collection copy action
Event data:- entity: Entity – Collection Entity object
Return false to cancel the event
BEFORE_COPY_COLLECTION_SUBMIT
Triggers before collection copy submit/done
Event data:- copyWithAssets: boolean – Copy with assets or not
- sourceCollection: Entity – Source collection entity
- newCollection: Object – Collection info like name.
Return { newCollection } to update payload or false to cancel the event
AFTER_COPY_COLLECTION_SUBMIT
Triggers after collection copy submit/done
Event data:- copyWithAssets: boolean – Copy with assets or not
- sourceCollection: Entity – Source collection entity
- newCollection: Object – Collection info like name.
BEFORE_DUPLICATE_ASSET_ACTION
Triggers before asset duplicate action
Event data:- entity: Entity – Asset Entity object
Return false to cancel the event
AFTER_DUPLICATE_ASSET_ACTION
Triggers before asset duplicate action
Event data:- entity: Entity – Asset Entity object
- newAssetInfo: Object – Contains information about newly created asset
BEFORE_DUPLICATE_COLLECTION_ACTION
Triggers before collection duplicate action
Event data:- entity: Entity – Collection Entity object
Return false to cancel the event
BEFORE_DUPLICATE_COLLECTION_SUBMIT
Triggers before collection duplicate submit/done
Event data:- collection: Object – Collection to be created with inputs
Return { collection } to update payload or false to cancel the event
AFTER_DUPLICATE_COLLECTION_SUBMIT
Triggers after collection duplicate submit/done
Event data:- collection: Object – Data about Newly created collection
BEFORE_EDIT_COLLECTION_PROPERTIES_ACTION
Triggers before edit collection properties action
Event data:- collectionMeta: Object – Data about collection
Return false to cancel the event
BEFORE_EDIT_COLLECTION_PROPERTIES_SUBMIT
Triggers before edit collection properties submit/done
Event data:- attributes: Object[] – Array of collection attributes
Return { attributes } to update payload or false to cancel the event
AFTER_EDIT_COLLECTION_PROPERTIES_SUBMIT
Triggers after edit collection properties submit/done
Event data:- attributes: Object[] – Array of collection attributes
BEFORE_EDIT_ASSET_PROPERTIES_ACTION
Triggers before edit asset properties action
Event data:- assetMeta: Object – Data about asset – when invoked from asset detail
OR - entities: Entities[] – Array of Entity objects
Return false to cancel the event
- assetMeta: Object – Data about asset – when invoked from asset detail
BEFORE_ASSET_PROPERTIES_SUBMIT
Triggers before edit asset properties submit/done
Event data:- entities: Entities[] – Array of Entity objects, only in case of multi select
- attributes: Object[] – Array of asset attributes
Return { attributes } to update payload or false to cancel the event
AFTER_ASSET_PROPERTIES_SUBMIT
Triggers after edit asset properties submit/done
Event data:- entities: Entities[] – Array of Entity objects, only in case of multi select
- attributes: Object[] – Array of asset attributes
- successEntities: Entities[] – Array of Entity objects, only in case of multi select
- failureEntities: Entities[] – Array of Entity objects, only in case of multi select
BEFORE_WORKFLOW_ASSET_SUBMIT
Triggers before workflow asset submit/done
Event data:- assetId: number – Asset Id
- attributes: Object – Asset attributes
Return { attributes } to update payload or false to cancel the event
AFTER_WORKFLOW_ASSET_SUBMIT
Triggers after workflow asset submit/done
Event data:- assetId: number – Asset Id
- attributes: Object – Asset attributes
BEFORE_ASSET_UPLOAD_ACTION
Triggers on file upload actionReturn false to cancel the event
BEFORE_UPLOAD_FOLDER_ACTION
Triggers on folder upload actionReturn false to cancel the event
BEFORE_ASSET_PREVIEW_TAB_ACTION
Triggers on Preview tab select
Event data:- assetMeta: Object – Data about asset
Return false to cancel the event
BEFORE_ASSET_HISTORY_TAB_ACTION
Triggers on History tab select
Event data:- assetMeta: Object – Data about asset
Return false to cancel the event
BEFORE_ASSET_LINK_TAB_ACTION
Triggers on Links tab select
Event data:- assetMeta: Object – Data about asset
Return false to cancel the event
BEFORE_ASSET_PROPERTIES_TAB_ACTION
Triggers on Properties tab select
Event data:- assetMeta: Object – Data about asset
Return false to cancel the event
BEFORE_ASSET_AUDIT_TAB_ACTION
Triggers on Audit tab select
Event data:- assetMeta: Object – Data about asset
Return false to cancel the event
BEFORE_ASSET_BRANCHES_TAB_ACTION
Triggers on selecting the Branches tab
Event data:- assetMeta: Object – Data about asset
Return false to cancel the event
BEFORE_ANALYTICS_TAB_ACTION
Triggers on selecting the Analytics tab
Event data:- assetMeta: Object – Data about asset
Return false to cancel the event
BEFORE_WORKFLOW_DIALOG_OPEN
Triggers before workflow dialog is opened on uploading new file/folder.
Event data:- attributes: Object – Data about asset
- silentSubmit: Boolean – Default false – Set true to silently checkin the file.
Additional Option that can be set:
attributes.assetAttributes: Array[Object]- Pass this when asset form attributes needs to be updated.
Format – { “attributeId”: 1XX, “attributeValue”: { “value”: “”}}
For example, for different type of attributes, the value key contains a different value.
Domain – Contains the array of domainValue values for multiple type domain attributes or contains the single object of the domainValue value for single type domain attribute.
Text – Contains a text string.
Date, DateTime, Time – Contain date, datetime, and time string, respectively.
Boolean – Contain true or false.
Number, Measurement – Contain Int and double type of value.attributes.versioning: “major“ | “minor“ | “custom“ | “branch“ – Default “minor“ – This option is to create a minor version, a major version, a custom version, or a branch.
atrtibutes.initialMajorVersion: number – Default 0 – This option is to specify the initial major version when the versioning is of type “custom”.
atrtibutes.initialMinorVersion: number – Default 1 – This option is to specify the initial minor version when the versioning is of type “custom”.
atrtibutes.branchLabel: string – Default “” – This option is to specify the branch label when the versioning is of type “branch”.
Return false to cancel the event
BEFORE_READ_ONLY_ACTION
Triggers before read only action
Event data:- assetId: number – Id of the asset
- contentType: string – Content type of asset
- majorVersion: number – Major version of asset
- minorVersion: number – Minor version of asset
Return false to cancel the event
BEFORE_REVERT_TO_VERSION_ACTION
Triggers before revert to version action
Event data:- assetId: number – Id of the asset
- revertVersion: Object – Contains major and minor version of the revert version
- latestVersion: Object – Contains major and minor version of the current latest version
- createMinorVersion: boolean – whether to create major or minor version
Return { createMinorVersion } to update the payload false to cancel the event
AFTER_REVERT_TO_VERSION_ACTION
Triggers after revert to version action
Event data:- attributes: Object[] – attributes of new create version