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

Question

Question

Remove Folder Shortcut

asked on May 25, 2017

Hi Everyone

I have issue with delete entry tool, that when i use it with workflow on shortcut it is delete the source folder not it's shortcut, while when i delete the shortcut manually from the Laserfiche client it work correctly (Just delete the shortcut, not the source folder of the shortcut) 

so what can i use in workflow to delete a specific shortcut (not the source entry or another shortcut of it)?

 

Thanks

0 0

Replies

replied on May 25, 2017 Show version history

In workflow, you want to use the Delete Shortcut activity instead of the Delete Entry

Or if you use the Routing activity, you can use the cleanup option to remove the shortcut when the wait condition is met.

Finally, if you want to remove a single shortcut, you can use a SDK script activity.

        Protected Overrides Sub Execute()
            'Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
            Using MyEntry as EntryInfo = Me.BoundEntryInfo
                If MyEntry.EntryType = EntryType.Shortcut Then
                    MyEntry.Lock(LockType.Exclusive)
                    MyEntry.Delete()
                    MyEntry.Save()
                    MyEntry.Unlock()
                End If
            End Using
        End Sub

Make sure the shortcut is the entry the script is targeting

1 0
replied on May 25, 2017

Hello Mr. Warren

I used the "Delete Shortcuts" activity but it delete all the shortcuts of the source folder, i need workflow delete specific shortcut of the source, at the same time I am not use the "Routing activity".

0 0
replied on May 25, 2017 Show version history

I just modified my response to add an option to remove a single shortcut with SDK script

 

EDIT:

After testing my code above, I find that it does not work.  I will look into different code to do it.

0 0
replied on May 25, 2017

The only way I found to delete the shortcut was through LFSO

        Protected Overrides Sub Execute()
            'Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
            Try
                Dim ClonedConn As LFConnection = New LFConnection()
                ClonedConn.CloneFromSerializedConnection(Me.Connection.GetSerializedConnection(9))
                Dim LFDB As LFDatabase = ClonedConn.Database
                Dim MyEntry As ILFEntry = LFDB.GetEntryByID(iEntryID)
                If MyEntry.EntryType = Entry_Type.ENTRY_TYPE_SHORTCUT Then
                    MyEntry.LockObject(Lock_Type.LOCK_TYPE_WRITE)
                    MyEntry.DeleteEx(Entry_Namespace_Flag.ENTRY_DELETE_FORCE_PURGE)
                End If
                LFDB = Nothing
                ClonedConn = Nothing
                SetToken("ErrorMessage", "")
            Catch ex As Exception
                SetToken("ErrorMessage", ex.Message)
            End Try
        End Sub

 

replied on May 25, 2017

I put the SetToken so that I could use a Track Token activity to see error messages thrown by the script.

replied on May 25, 2017 Show version history

The only way I found to delete the shortcut was with LFSO.

        Protected Overrides Sub Execute()
            'Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
            Dim sMsg as String = ""
            Try
                Dim ClonedConn As LFConnection = New LFConnection()
                ClonedConn.CloneFromSerializedConnection(Me.Connection.GetSerializedConnection(9))
                Dim LFDB As LFDatabase = ClonedConn.Database
                Dim MyEntry As ILFEntry = LFDB.GetEntryByID(Me.BoundEntryId)
                If MyEntry.EntryType = Entry_Type.ENTRY_TYPE_SHORTCUT Then
                    MyEntry.LockObject(Lock_Type.LOCK_TYPE_WRITE)
                    MyEntry.DeleteEx(Entry_Namespace_Flag.ENTRY_DELETE_FORCE_PURGE)
                Else
                    sMsg = "Entry not a Shortcut"
                End If
                LFDB = Nothing
                ClonedConn = Nothing
            Catch ex As Exception
                sMsg = ex.Message
            End Try
            SetToken("ErrorMessage", sMsg)
        End Sub

I added the SetToken to the code so that I could then use a Track Tokens activity to see what errors the script was throwing.

0 0
replied on May 25, 2017

Also, in my testing, if the Delete Entry activity is acting on a shortcut, it only deletes the shortcut.

1 0
replied on May 26, 2017

In my workflows, when I have shortcuts being deleted, I first find all shortcuts and put the shortcut paths into a token before deleting the shortcut.  At the end of the workflow I have a for each value activity that take each value in the shortcut paths token, checks to see if there are other entries in that folder and if not, deletes the folder.

ShortcutPath.jpg
ShortcutFolderDelete.jpg
ShortcutPath.jpg (133.07 KB)
0 0
replied on May 26, 2017

My posting my not be of help if you are having the issue with a document shortcut.  I misread your post and thought you were asking how to delete the folder that the shortcut was in.

0 0
replied on May 26, 2017

Can you post screenshots of your workflow? Like Bert, I'm not seeing the behavior you're describing. Delete Entry pointed at a shortcut only deletes the shortcut, not the entry itself.

0 0
replied on May 26, 2017

Hello Mr. Babatie
Soon I'll post a screenshot,

appreciate your efforts
Thank you all

0 0
replied on May 28, 2017

Dear Mr. Babatie

kindly find the attached video which represent my issue.

0 0
replied on May 28, 2017 Show version history

The workflow is doing exactly what you have told it to do.  Your start rule triggers on the Folder entry and not the shortcut (the shortcut is deleted because the entry it points to was deleted) because the metadata is not on the shortcut but on the folder entry.  When you access from a shortcut, you are still accessing the entry and not the shortcut.

I think the best way to get around this is to use a Business Process.  So rather than trying to set a field on the "Shortcut", run a Business Process on it (the shortcut).

When you publish, if you choose not to display Business Process Information, you will get a warning, but just click the "Publish Anyway" button.  Then you will be prompted to log in and set Business Process Rules.

After setting the BP Requirement to be a Folder Shortcut, click OK to finish.

 

Then the next time users log into the repository, they will be able to select a folder shortcut and run the BP on it.

0 0
replied on May 27, 2017

Hi Everyone
Dears I think the issue was due misconfigured from me,
I do not know, the delete activity sometime work on shortcut correctly and sometime not (works on source folder) but i think it just misconfigured,

What i need to be certain of that "Delete Entry" activity works on shortcut separately from source folder 

I am sorry to bother you
and I thank you all and approciate you efforts

0 0
replied on May 27, 2017

As a safeguard, you may want to implement a Conditional Decision activity something like this:

0 0
replied on May 27, 2017

Yes i used an Conditional Decision based on entry type to sure it work on the shortcut.

Thank all you for your interest

smiley

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

Sign in to reply to this post.