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

Question

Question

Workflow SDK Script "The object must have its connection set before it can be used."

asked on July 21

Ok, I've been banging my head on the wall for a few days now...  I can't see anything wrong with this script, but when I try to test it I get "The object must have its connection set before it can be used." It seems to be based on the call to RASession, but I can't seem to determine what I'm doing wrong.

namespace WorkflowActivity.Scripting.SDKScript
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Laserfiche.RepositoryAccess;
    using System.IO;
    using System.Linq;
    using Microsoft.VisualBasic.FileIO;
    using System.Text.RegularExpressions;
    using System.Globalization;


    /// <summary>
    /// Provides one or more methods that can be run when the workflow scripting activity is performed.
    /// </summary>
    public class ReportLoader : RAScriptClass102
    {
        /// <summary>
        /// This method is run when the activity is performed.
        /// </summary>
        protected override void Execute()
        {
            DocumentInfo doc = Document.GetDocumentInfo(this.BoundEntryId, RASession);
            string documentName = doc.Name;
        }
   }   
}

Running the workflow with the script gives a "Object reference not set to an instance of an object."

So what obvious thing am I missing here?

0 0

Replies

replied on July 21 Show version history

Will, A couple of thoughts;

Line 27 is trying to get a reference to the bound entry.  Are you sure you have a starting entry specified when you run the script?

Also, not sure where you are going with the additional script references.  I don't believe Microsoft.VisualBasic .FileIO is a valid assembly.  Should you be referring to the System.IO assembly to get access to file functionality?

BTW - The script works fine on my system (10.4.2) once I remove the reference to the Microsoft.VisualBasic.FileIO assembly...

1 0
replied on July 21

Thanks, I'm beginning to think that it's some kind of environmental issue, I have a similar script which works fine on another workflow server but produces similar errors when I try to run it on our dev environment...  Trying to determine if there's some work-a-round that can be used.

The Microsort.VisualBasic .FileIO is an included reference and needed for interfacing with some electronic data files (CSV files) which need to be processed as part of the workflow but for now I can't even access the session to get to a repository entry to get the electronic data... 

 

0 0
replied on July 21

What version of Workflow are you using? This script says RAScriptClass102 so make sure you are referencing Laserfiche.RepositoryAccess 10.2 (the default version for scripts corresponds to the version of Workflow, so if you are attempting to run this in anything other than 10.2, you either have to change the reference to version 10.2 or change the script to RAScriptClass to match the version of WF).

I'm going to add one more vote to what Cliff said about not using Microsoft.VisualBasic.FileIO in a C# script.

1 0
replied on July 21

Using Workflow Designer version 10.4.2 

Laserfiche.RepositoryAccess is version 10.2.0.0

 

 

0 0
replied on July 21 Show version history

Will,

If you open up the code window on an unmodified SDK Script activity does the public class inherit RAScriptClass102 or RAScriptClass104?  As Miruna indicates; if the Workflow version is at 10.4 then the SDK Script activity should default to RAScriptClass104 and the reference to Laserfiche.RepositoryAccess should be at 10.4 as well.

Or are you intentionally trying to target 10.2 on a 10.4 system?

1 0
replied on July 22

I know I'm using Workflow Designer 10.4.2, and I've checked with one of our admins to confirm that the Workflow Server is 10.4.2 as well. Yet creating a new SDK script creates one of RAScriptClass102, not 104. 

 

 

 

 

0 0
replied on July 22

I would echo your concern then about the environment. 

One option would be to manually change the script to inherit RAScriptClass104 and to update the references to point to the 10.4 assemblies but I am not sure that is the appropriate solution.

Perhaps Laserfiche can chime in or perhaps you can open a support call to your SP for follow up?

0 0
replied on July 22

I can't reproduce that behavior on 10.4. We do have a known issue that RA does not load properly in some cases, but that would result in an error, not in reverting the version of RA used.

Are you sure your Designer is 10.4 and you're not copying the activity or the code from an existing workflow that was made with an earlier version?

 

0 0
replied on July 23

So I've managed to get a new Script to create as RAScriptClass104 by creating a fresh Workflow; however my basic script is still not working... this time I am getting the error message of "An HTTP operation has timed out."

 

I've created a ticket with our Laserfiche support.

 

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

Sign in to reply to this post.