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

Question

Question

Error al ejecutar Script en VB

asked on July 30, 2020

Hello

We have a WF that executes a script developed in VB that exports documents to an Operating System folder, we had it configured in version 9, updating to version 10.3 gives us an error, the developer who prepared this code is no longer with us and the person who is now does not have that domain, how can we solve this error.

The error it gives us is:

This script uses base class RAScriptClass102 which does not match the reference 'Laserfiche.RepositoryAccess, Version=9.1.0.0, Culture=neutral, PublicKeyToken=3f98b3eaee6c16a6'. Please match the base class to the reference by changing it to RAScriptClass91 or updating the reference.

 

Thanks

 

Ricardo Cairo

0 0

Answer

SELECTED ANSWER
replied on August 10, 2020

It looks ike you already changed it once from 102 to 92: "   public class Script1 : RAScriptClass91 //RAScriptClass102 ". So remove "RAScriptClass91 //" to turn it back into "public class Script1 : RAScriptClass102".

 

0 0

Replies

replied on July 30, 2020

You can look at Workflow to Export Document to Windows Folder for a SDK script for use with WF 10

1 0
replied on July 30, 2020

It sounds like you're copying the script into a WF 10.2 installation and have mismatched references? Can you post a screenshot of the script editor or the full contents of the script so we can see where the mismatch is?

0 0
replied on July 30, 2020

He're the script:

namespace WorkflowActivity.Scripting.ScriptparaexportardocumentosfueradeLaserfiche
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Laserfiche.DocumentServices;
    using Laserfiche.RepositoryAccess;
    using Laserfiche.Workflow.Activities;
    using Laserfiche.SecurityTokenService;
    using Laserfiche.UI;
    using System.IO;
    using LFSO90Lib;
    using System.Xml.Serialization;
    using System.Xml;
    using System.Text.RegularExpressions;
    using System.Xml.Linq;

    /// <summary>
    /// Provides one or more methods that can be run when the workflow scripting activity is performed.
    /// </summary>
    public class Script1 : RAScriptClass91 //RAScriptClass102
    {
        /// <summary>
        /// This method is run when the activity is performed.
        /// </summary>
        protected override void Execute()
        {
            string valor = "";
            string campo = "";
            string paso = "0";
            string _c = "";
            string _v = "";
            string NoExpediente = "";
            string Clasificacion = "";
            string rutabase = "C:\\Users\\rcairo\\Box Sync\\Conciliaciones PGS KHR DWT\\4. FACTURAS PGS KHR\\";

            try
            {
                DocumentInfo DI = (DocumentInfo)this.BoundEntryInfo;
                EntryInfo entry = Entry.GetEntryInfo(DI.Id, RASession);
                var fvc = entry.GetFieldValues();

                PageInfo pgInfo = DI.GetPageInfo(1);
                DocumentStatistics docStats = DI.GetStatistics();

                string volumeName = DI.VolumeName;
                string pagePath = pgInfo.ImageFilePath;
                string edocPath = docStats.ElecDocumentPath;

                //CREAR FOLDER PRINCIPAL
                string folderLocation = rutabase;
                bool exists = System.IO.Directory.Exists(folderLocation);
                if (!exists)
                {
                    System.IO.Directory.CreateDirectory(folderLocation);
                }

                string p = DI.Path.Split('\\')[4] + "\\" + DI.Path.Split('\\')[5] + "\\" + DI.Path.Split('\\')[6] + "\\" + DI.Path.Split('\\')[7].Split('/')[0];

                string filePath = @"C:\temp\Error.txt";
                using (StreamWriter writer = new StreamWriter(filePath, true))
                {
                    writer.WriteLine("Mensaje :" +  p.Trim());
                }


                //CREAR FOLDER PARA DOCUMENTOS
                string folderExpedienteLocation =  rutabase + p + "\\";
                bool existsNoExp = System.IO.Directory.Exists(folderExpedienteLocation);
                if (!existsNoExp)
                {
                    System.IO.Directory.CreateDirectory(folderExpedienteLocation);
                }

                DI.Lock(LockType.Exclusive);

                DocumentExporter dExp = new DocumentExporter();
                dExp.CompressionQuality = 50;
                dExp.IncludeAnnotations = true;
                dExp.BlackoutRedactions = true;
                dExp.PageFormat = DocumentPageFormat.Jpeg;

                var ExportOptions = PdfExportOptions.RenderAnnotationsAsImage | PdfExportOptions.IncludeText;

                string path = folderExpedienteLocation;
                string filename = DI.Name + ".pdf";

                dExp.ExportPdf(DI, DI.AllPages, ExportOptions, path + filename);

                DI.Unlock();
                DI.Dispose();

            }
            catch(Exception ex){
                string filePath = @"C:\temp\Error.txt";
                using (StreamWriter writer = new StreamWriter(filePath, true))
                {
                    writer.WriteLine("Mensaje :" + paso + Environment.NewLine + campo + ":" + valor + Environment.NewLine +  ex.Message  + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
                    "" + Environment.NewLine + "Fecha :" + DateTime.Now.ToString());
                    writer.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
                }
            }

        }

        //use System.Text.RegularExpressions before using this function
        public bool vldRegex(string strInput)
        {
        //create Regular Expression Match pattern object
        Regex myRegex = new Regex("/[0-9A-Fa-f]{6}/g");
        //boolean variable to hold the status
        bool isValid = false;
        if (string.IsNullOrEmpty(strInput))
        {
        isValid = false;
        }
        else
        {
        isValid = myRegex.IsMatch(strInput);
        }
        //return the results
        return isValid;
        }

    }

    public class MetaData
    {
         public string Campo {get; set;}
         public string Valor {get; set;}
    }

}

0 0
replied on August 3, 2020

"public class Script1 : RAScriptClass91" indicates that this script is supposed to use RA 9.1. Either change the RepositoryAccess reference to 9.1 or update the script class to RAScriptClass102 to use the builtin RepositoryAccess 10.2.

This script seems to be a compilation of other scripts. Please remove the following references (as they are not used so there is no need to maintain them):

    using Laserfiche.SecurityTokenService;
    using Laserfiche.UI;
    using LFSO90Lib;

Also note that Workflow is multi-threaded so you may have multiple activities attempt to write to C:\temp\Error.txt at the same time.

0 0
replied on August 7, 2020

Thanks MIruna, How do we updete the script class?

 

0 0
SELECTED ANSWER
replied on August 10, 2020

It looks ike you already changed it once from 102 to 92: "   public class Script1 : RAScriptClass91 //RAScriptClass102 ". So remove "RAScriptClass91 //" to turn it back into "public class Script1 : RAScriptClass102".

 

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

Sign in to reply to this post.