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

Question

Question

How do I check for document links using workflow 8.3 SDK Script

asked on April 15, 2014 Show version history

Edit: It turns out the script is perfectly valid, the issue was it wasn't being executed because I didn't realize that failure to find a document in the find document activity would generate an exception. 

 

 

It looks like you can't determine if a document has links via a the built in workflow activities.

 

I'm unsure of what classes and objects are available to the workflow script editor under the context it runs under. 

 

Is this code valid for a simple script part to check and see if there is links on the scripts default entry then set a preexisting token to have an integer value that equals the number of links? (so I can use that to token to determine if I need to send an e-mail later in the workflow. )

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports LFSO83Lib

Namespace WorkflowActivity.Scripting.Checkforlinks
    '''<summary>
    '''Provides one or more methods that can be run when the workflow scripting activity is performed.
    '''</summary>
    Public Class Script1
        Inherits SDKScriptClass83
        '''<summary>
        '''This method is run when the activity is performed.
        '''</summary>
        Protected Overrides Sub Execute()
            'Write your code here.
            Dim targetEntry as ILFEntry = Me.Entry
            Dim Links as ILFCollection = targetEntry.FindLinks()

            Me.SetTokenValue(("linkCount"),Links.Count)


        End Sub
    End Class
End Namespace

 

See next post for edited workflow

workflow.png
workflow.png (14.25 KB)
1 0

Answer

SELECTED ANSWER
replied on April 16, 2014

Your SetTokenValue has an extra set of parentheses. Is that just a typo here or in your code too? It should be:

 

Me.SetTokenValue("linkCount",Links.Count)

Before saving the script, make sure you clicked "Auto-detect Tokens" in the Script Tokens pane in the Script Editor. Version 8.3 wasn't always detecting tokens correctly.

1 0

Replies

replied on April 15, 2014

I should say that the script works if I run it in the debugger and select the Target entry however it doesn't run if I use it from code. 

 

I also updated the workflow a bit, (it still isn't running quite right)

 

0 0
replied on April 17, 2014

I figured the whole thing out that extra parenthesis didn't seem to make a difference. The big issue for me was that I didn't know that find document threw an exception if it didn't find the exception so I had a failing branch. I wrapped that stuff in Try Catch and it all worked fine. 

 

I'll probably redo the whole thing in VB or C# later, because as much as I see the benefits of drag and drop workflows the limitations and not being able to see what's going on bugs me. 

 

Jason

0 0
replied on April 18, 2014

In 9.1, Find Entry and Search Repository can also return a token for whether the document has links or not.

 

I'm not sure what you mean by not being able to see what's going on? Activity errors are logged to the instance details. And if you want to see the entire stack trace for an error, it's available in the Error Logs node in the WF Admin Console.

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

Sign in to reply to this post.