Hello,
Need a workflow to retrieve all documents included in a document's link group.
Any pointer?
Hello,
Need a workflow to retrieve all documents included in a document's link group.
Any pointer?
Stephane - If I understand correctly you want to locate all documents that are included in the link group of a specific document. This example assumes that the bound entry of a workflow is in a link group. It uses an SDK script activity to build a list of all of the documents in the bound entry link group and exposes that list as a multi-value token. In this small workflow example I am then stepping through that list of entry ID's and moving the documents to another folder.
The token list for the above workflow looks like this on my test system. It shows a list of three entry ID's that are part of the link group that the bound entry (97634) contains;
Here is the script for the SDK Script Activity. (The script is RA for newer versions of Workflow, if you need LFSO code for an earlier version then let me know);
Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Data.SqlClient Imports System.Text Imports Laserfiche.RepositoryAccess Namespace WorkflowActivity.Scripting.SDKScriptToBuildListOfEntryIDs '''<summary> '''Provides one or more methods that can be run when the workflow scripting activity is performed. '''</summary> Public Class Script1 Inherits RAScriptClass92 '''<summary> '''This method is run when the activity is performed. '''</summary> Protected Overrides Sub Execute() 'Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session 'Instantiate the list to hold the entry ID's if found... Dim idList As List(Of Integer) = New List(Of Integer) 'Check to make sure the bound entry is a document... If Me.BoundEntryInfo.EntryType = EntryType.Document Then 'Get a reference to the bound entry... Dim docInfo As DocumentInfo = DirectCast(Me.BoundEntryInfo, DocumentInfo) 'Try to get any version group that the document is a member of... Dim vGroup As VersionGroup = docInfo.TryGetVersionGroup() 'If there is a version group then step through the group and add 'each entry ID to the list... If vGroup IsNot Nothing Then For i As Integer = 0 To vGroup.VersionCount -1 idList.Add(vGroup.Versions(i).EntryId) Next End If 'Cleanup... docInfo.Dispose End If 'The list will be returned as the LinkList token... Me.SetTokenValue("LinkList", idList) End Sub End Class End Namespace
Hello Stephanie,
You can enter a comment in the documents within the link group you'd like Workflow to find. You can then use the "Search Repository" activity in Workflow to find the documents contained within that link group.
The search syntax to use in order for Workflow to be able to find these documents looks like this:
{LF:LinkGroupComment~="test"}, where test is the comment that you entered for each document in the group.
Hopefully this helps! Since this is a bit of a workaround, if you'd like to see this feature added to a future release, let us know! We would love to hear about the process you have, why you chose link groups, and how you plan to process these documents with Workflow.
Good luck!