Create New Workflow Trigger

Overview

This workflow trigger instantiates workflows for analogous assets to support translation capabilites or cross-site content synchronization.

This workflow trigger works on the premise that a client has their content set up in the following structure:
  • en
  • de
  • fr
Assume the internet folder has a target named internet with base folder internet. Assume each of the subfolders has an asset "page" in them. These are the "analogous assets". Analagous assets must have the same name for this plugin to work.

Whenever one of these analogous assets is edited and placed into a workflow containing this trigger, this trigger will start corresponding edit workflows for the other two analogous assets. For example if /internet/en/page was edited, /internet/de/page and /internet/fr/page would be put into an edit workflow of the user's specification (denoted by the invoked-workflow-definition-path parameter).

Declaration


            <trigger class="com.cms.workflow.function.CreateNewWorkflowsTrigger" name="CreateNewWorkflow"/>
            

Usage


            <trigger name="CreateNewWorkflow">  
   <parameter>  
      <name>target</name>  
      <value>/internet/de</value>  
   </parameter>  
   <parameter>  
      <name>base-folder</name>  
      <value>/internet/en</value>  
   </parameter>  
   <parameter>  
      <name>invoked-workflow-definition-path</name>  
      <value>/translate_de</value>  
   </parameter>  
   <parameter>  
      <name>owner</name>  
      <value>some_user_with_write_access_to_de</value>  
   </parameter>  
   <parameter>  
      <name>target</name>  
      <value>/internet/fr</value>  
   </parameter>  
   <parameter>  
      <name>base-folder</name>  
      <value>/internet/en</value>  
   </parameter>  
   <parameter>  
      <name>invoked-workflow-definition-path</name>  
      <value>/translate_fr</value>  
   </parameter>  
   <parameter>  
      <name>owner</name>  
      <value>some_user_with_write_access_to_fr</value>  
   </parameter>  
</trigger>
            

Parameters

The trigger is capable of taking multiple parameters of the same name.

Invoked-Workflow-Destination-Path Parameter

The path of the Workflow Definition to be used by the trigger (e.g. Internet/1-Step-Edit-WF). 

Invoked-Workflow-Definition-Site-Name Parameter

Site name where the Workflow Definition is located. If no explicit Site is specified, the Workflow Definition is assumed to be in same Site as the asset in workflow.

Target Parameter

The target parameter specifies a target path that will be used to calculate the analogous asset paths. For this trigger to work properly, the target structure should mirror the folder structure, such that each individual folder (en, de, fr) has its own target (en, de, fr). In this example, a workflow is started on /internet/en/page, with additional workflows created for /internet/de/page and /internet/fr/page. The target parameter is set based on the workflows to be started - /internet/de, with the /internet/de folder as its base folder and /internet/fr, with the /interent/fr folder as its base folder.

Folder-Path Parameter

Alternatively, the folder-path parameter can be used which explicitly specifies the analogous assets’ base folders explained above.

Base-Folder Parameter

The base-folder parameter should specify base folder for current asset, meaning the asset on which this workflow is being executed on. In the example above it would be /internet/en.

In this example the relative folder path would be /fr for the French site and /de for the German site. Then the trigger will attempt to locate the analogous asset by building a path of the form $COMMON + $RELATIVE + $ASSET_NAME, which would yield /internet/fr/page and /internet/de/page for French and German sites, respectively. It then instantiates those assets into the edit workflow specified by invoked-workflow-definition-path whose owner will be specified by the owner parameter.

This trigger also handles creates and copies. For creates, when an asset is created a new additional asset with the same name and same data should be created in the folders where the other analogous assets live. The same goes for copies.

In total, the user will need to set up two workflow definitions (create, edit, copy) on each analogous folder. One workflow definition will be the workflow definition containing this trigger, which will spawn the workflows for the analogous assets. The other workflow definitions are the ones that will be spawned when an asset in some other analogous folder is created, edited, or copied.

In this example the administrator would set up the trigger in the workflow on the "en" folder to have the triggers set as such:


            <parameter>  
  <name>target</name>  
  <value>/internet/de</value>  
</parameter>  
<parameter>  
   <name>base-folder</name>  
   <value>/internet/en</value>  
</parameter>  
<parameter>  
   <name>invoked-workflow-definition-path</name>  
   <value>/translate_de</value>  
</parameter>  
<parameter>  
   <name>owner</name>  
   <value>some_user_with_write_access_to_de</value>  
</parameter>
            
to handle "de" and

            <parameter>  
  <name>target</name>  
  <value>/internet/fr</value>  
</parameter>  
<parameter>  
   <name>base-folder</name>  
   <value>/internet/fr</value>  
</parameter>  
<parameter>  
   <name>invoked-workflow-definition-path</name>  
   <value>/translate_fr</value>  
</parameter>  
<parameter>  
   <name>owner</name>  
   <value>some_user_with_write_access_to_fr</value>  
</parameter>
            
to handle "fr".