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

Question

Question

Original Path for an Entry before it moves

asked on May 20, 2014

I am working on a workflow to capture the original path before the entry moves.  The value I am getting from "Entry Path" token is the new location of the entry after it moves.  Is there a way to get the original path?

 

 

0 0

Answer

SELECTED ANSWER
replied on May 27, 2014
            Dim sourceParentPath as String = ""
            Dim uuid as Guid = me.StartingEntryInfo.Uuid
            Dim currentParent as Integer = me.StartingEntryInfo.ParentId
            
            Dim reader as ActivityLogReader = new ActivityLogReader(uuid, SortDirection.Descending, me.RASession)
            Try                
                Dim count as Integer = 0
                
                ' Only check up to the last 100 events for performance reasons
                while reader.Read() and count < 100
    
                    Dim activity as ActivityRecord = reader.Item
                    if  activity.ActivityType = ActivityType.MoveEntry then
                        Dim moveActivity as MoveEntryActivity = activity
                                            
                        ' Check the destination parent id to make sure its the move to the current folder.
                        if moveActivity.DestinationParentId = currentParent then 
                            sourceParentPath = moveActivity.SourceParentPath
                            exit While
                        end if
                    end if
                    count = count + 1
                end While
    
                WorkflowApi.SetTokenValue("path1", sourceParentPath, False)
            Finally
                reader.Close()
            end Try
0 0
replied on June 10, 2014

Thanks Ed!

 

 

0 0

Replies

replied on May 20, 2014

I'll add a feature request to the product to get this information more directly and efficiently.

 

With a little bit of scripting you could get this from the activity log of the server. If using RepositoryAccess, use the ActivityLogReader class, pass in the uuid of the entry and look for the last move activity (MoveEntryActivity). The source parent path and id would be available. Be sure to check the destination properties to account for multiple move events happening in quick succession.

1 0
replied on May 26, 2014

HI Ed,

 

I tried this and I was able to pass the UUID to ActivityLogReader to look for the last move activity but I couldn't figure out how to get the value in MoveEntryActivity.  I can get to SourcePath from MoveEntryActivity but the session entry value is not being retrieved.  Do you have a sample script for this?  Any suggestion is appreciated

 

Below is what I tried ...

 

Dim MySession as Session = me.RASession

 
Dim EntryID as Integer = System.Convert.ToInt32(me.GetTokenValue_("EntryID").ToString)
 
Dim Activity as New ActivityLogReader(Entry.GetEntryInfo_(EntryID,MySession).Uuid, SortDirection.Descending, MySession)
 
Dim MovActivity as MoveEntryActivity
Dim OriPath as string = MovActivity.SourcePath
       
WorkflowApi.SetTokenValue("path1",OriPath,False)

 

 

 

Thanks for your help

 

AJ

1 0
replied on May 20, 2014

Who is doing the moving? Is a user moving it, or is there another workflow?

0 0
replied on May 20, 2014 Show version history

We would have to know more about the WF with events before the move.  Is the document you are moving the starting entry?  You could also add a Find Entry before the move step in the Workflow to get the path.

0 0
replied on May 20, 2014

From the research I have done there is no way to get this information. I run into this problem too. The only token available on an entry move event is the final destination. However the entry deleted event does pass a token for the original destination. If only entry moved could do this as well.

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

Sign in to reply to this post.