Skip to main content
Kofax

How to use Input and Output variables on a Script Node

Article # 3035203 - Page views: 432

Issue

How to use Input and Output variables on a Script Node

Solution

When to use this feature? 

Script activities are used whenever expression, .NET and Web Services are not appropriate. They remain in the product for legacy reasons. We hope that the newer features of the product help to reduce the need for any custom code. However, for these provide the mechanisms to write code within the process.
We have 3 types of Script nodes available in Kofax TotalAgility:

  1. Script (VB Script)
  2. C#
  3. VB.net
Configuring the Script Nodes to use Input/Output variables 

In a Kofax TotalAgility business process, we have two string variables (any type can be used, this is for an example only)
NameIn
NameOut

Add your desired type of Script node to the process,
Map the variables as inputs/outputs depending on your requirements
i.e. 
When getting the value of a process variable in a script, assign the variable as an input to the activity.
When setting a the value of a process variable in a script, assign the variable as an output from the activity

Script Node example 
dim sNamevalue
dim sNameValueOut

sNamevalue= Sparms.Find("[NameIn]")
sNameValueOut = UCase(sNamevalue)
SParms.SetOutputParameter"[NameOut]", sNameValueOut
C# Node example 
using System; 
using Agility.Server.Scripting.ScriptAssembly;

namespace MyNamespace
{ 
 public class Class1
 {
  public Class1() 
  {
  }
  [StartMethodAttribute()] 
  public void Method1(ScriptParameters sp) 
  {
    //            
    // TODO: Add start method code here
    //
   string Name = sp.InputVariables["[NameIn]"].ToString();
    sp.OutputVariables["[NameOut]"] = "any value";
  }
 }
}
VB.Net Node example
Imports System
Imports Agility.Server.Scripting.ScriptAssembly
Namespace MyNamespace

    Public Class Class1
            <StartMethodAttribute()> Public Sub Method1(ByVal sp As ScriptParameters)
            '            
            ' TODO: Add start method code here
            '
        Dim Name
           Name = sp.InputVariables("[NameIn]")
           sp.OutputVariables("[NameOut]") = "value"
            End Sub
    End Class
End Namespace

Level of Complexity 

Moderate

Applies to  

Product Version Build Environment Hardware
Kofax TotalAgility v7.x      

References

 

Article # 3035203
  • Was this article helpful?