Skip to main content
MediaBeacon University

Example of Triggering Workflow from Badge Script

Version: 8.4

Issue 

Explanation of how to trigger a Advanced Workflow to operate upon a specific asset via a highlight badge

Resolution

Configure Workspace Badges

On the a Workspace with a view widget:

  1. Enter Admin mode by right-clicking and selecting admin
  2. Select the Settings gear icon on the view widget on the workspace
  3. In the settings of the view widget, go to Highlight Config
  4. Create a new highlight
    1. Set Criteria and Set the fields
    2. Enable the Badge and select the desired icon for the badge with the Badge Title
    3. Enable the Javascript Action
    4. The text window below the “Enable Javascript Action:” is for the Badge script code

MediaBeacon Client JS API call for triggering a workflow

See the "triggerWorkflow" entry in the MediaBeacon API page for more info: https://www.mediabeacon.com/api

Here is an example of the code in use:

// Set the Workflow ID from the Client-Side Triggering option
var kSendNotificationEmailMBUID = "F045FA7D-3F30-49DC-BFEB-5A3AFE7B8BAA";

// Store parameters to be passed to the workflow script
var aParams = new Object();
aParams.badgeScript = kScriptName;
aParams.targetAsset = "" + myTargetAssetID;

// Trigger the workflow script
window.top.MBAPI.triggerWorkflow(kSendNotificationEmailMBUID, function(){}, aParams);
  • Notice the “kSendNotificationEmailMBUID” variable from above.  This is the workflow ID that can be found when enabling “Client-Side Triggering” in an advanced workflow.

  • Also Notice the “aParams” variable from above.  This is a way to pass parameters from the Client side script into the workflow.  The workflow can then use information that has been passed on from the client side script like below:

// Retrieve the asset object for the badge target asset
myRequestAsset = fileManager.getFileObjectById(context.getParameter(’targetAsset’));
  • Was this article helpful?