You are viewing limited content. For full access, please sign in.

Question

Question

Get tags from parent folder

asked on June 20, 2017

I have a folder structure that I have set up. Let's consider these folders "system" folders. I want to allow users to add sub-folders within these folders as they desire for their own use. Let's consider those folders "user" folders. In some of my workflows, I only want to act on documents found in "system" folders while leaving documents in "user" folders alone, and I don't want to have to explicitly name each and every system folder in the starting conditions because sometimes this can be quite a few folders. I am considering adding a tag to the "system" folders, and then having these workflows see if the tag is set on the parent folder of the starting entry before continuing. I have done some Googling and searching on this site. It appears that my option is to use scripting to get the parent folder tags as there is no way to do any processing or querying of a parent folder otherwise. Can someone provide me with a sample script that I can put at the top of my workflow to check for this system folder tag on the parent folder before moving forward? Thank you.

0 0

Answer

SELECTED ANSWER
replied on June 20, 2017

Never mind, I got it. Here is what I did, in case anyone else might find it useful. I not only set the boolean value, but also went ahead and returned all the tags in case I might need them in the future.

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.SDKScript
    '''<summary>
    '''Provides one or more methods that can be run when the workflow scripting activity is performed.
    '''</summary>
    Public Class Script1
        Inherits RAScriptClass102
        '''<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
            Dim parentFolder as FolderInfo = BoundEntryInfo.GetParentFolder()
            Dim tagtoFind as TagInfo = Tag.GetInfo("System Folder", RASession)
            Dim isSystem as Boolean = False
            Dim tagName as String
            Dim myList As List(Of String) = New List(Of String)

            For Each eTag As EntryTag in parentFolder.GetAssignedTags()
                tagName = Tag.GetInfo(eTag.TagId, Me.RASession).Name
                myList.Add(tagName)
                if tagName = "System Folder" Then
                    isSystem = True
                End If
            Next
            Me.SetTokenValue("TagList", myList)
            Me.SetTokenValue("SystemFolder", isSystem)
        End Sub
    End Class
End Namespace

 

0 0

Replies

replied on June 20, 2017

You could use EntryInfo. GetAssignedTags to get a collection of all the tags on the folder if you want to use a script. But you could also do this with the existing built-in activities.

 

0 0
replied on June 20, 2017

I don't believe any of what you have proposed will work in my case. My workflow executes on change, create, or move of a document. The user puts a document into one of the folders, therefore the "move" condition kicks off the workflow. In the workflow, the entry is the document itself. Therefore, I need to get the parent folder of the entry, somehow. I don't see an activity or action that will get me properties or tags of the parent (i.e. folder) of the entry that is the subject of the workflow. Therefore, unless I am wrong about that, I would need a script at the top of the workflow where I can read the tags of the parent folder of the entry. I don't know what to do for that script.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.