Metadata Syncing Template

This workflow runs when fields change on an entry. If the fields change on a folder, the fields on all the documents in that folder will be updated to match. If the fields change on a document, the fields for that document’s folder and all the other documents in that folder will be updated to match. This workflow automatically ensures fields remain consistent so users can be confident the fields on whatever entry they are looking at are up to date.

Learn more about workflow templates.

How it works

A Conditional Decision activity defines two possible courses of action depending on if the entry is a document or folder.

  • If the entry is a document,
    • A Find Entry activity finds the document’s folder, and a Copy Metadata activity copies fields from the document to the folder.
    • A Find Entries activity finds all the documents in that document’s folder.
    • For each document found, a For Each Entry activity copies fields from the starting entry (the document whose fields changed initially) to the document currently being processed.
  • If the entry is a folder,
    • A Find Entries activity finds all the documents in the folder.
    • For each entry found, a Copy Metadata activity within a For Each Entry activity copies fields from the starting entry (the folder whose fields changed initially) to the document currently being processed.

Note: Because no condition is specified on the “Entry is a folder” branch of the Conditional Decision activity, that branch will act as an exception branch and will run if the entry is not a document. Since the starting event specifies the entry must be a folder or document, the “Entry is a folder” branch should only process folders. If you edit this workflow to run on other types of entries, you will need to update these conditions, and potentially add an exception branch to the activity.

Important note

Ensure the Exclude Process Automation User checkbox is selected in the starting event when you run this workflow. Otherwise, the workflow will start itself continuously, quickly slowing your Workflow Server.

Why? The workflow will start itself because the workflow starts when fields are changed. When the workflow synchs the fields, it makes additional changes to the fields, which in turn satisfy the starting event, starting the workflow again. If you exclude the workflow user, any changes that the workflows makes to fields will be ignored, and the workflow will only run when a user changes fields.

To run this workflow template in the provided test environment

  1. Ensure the WT- Metadata Syncing starting event is enabled.

    1. Navigate to the Condition page in Starting Events.
    2. Select the starting event, and click Enable in the top right.
  2. In your Laserfiche repository, set or delete a field value on a document or folder in the \Workflow Templates - Test Entries\Sales\ Contracts folder.

Alternatively, you can test the workflow (bypassing the starting event) with the Run Workflow button in the Workflow Designer. Test this workflow on the Statement_of_Work document in the Workflow Templates - Test Entries\Sales\Contracts\Company EFG folder and watch its metadata be copied to the other documents in the folder and to the folder itself.

Ideas to expand this workflow

If you do not want field changes on a document to update the fields on the folder or on other documents, delete the first branch in the Conditional Decision activity.

The template is only configured to interact with documents and folders. If you want to sync record series, shortcuts, and subfolders, change the starting event conditions for the workflow and/or the options in the Find Entries activities’ Filter Entries property boxes to account for those entry types. Additionally, edit the conditions in the Conditional Decision activity to account for these other entry types.

Remember to republish the workflow after making any changes.