.NET Script activity
Use the .NET Script activities to write .NET scripts. The TotalAgility Designer allows you to create two types of .NET Script activities: VB.NET and C#.
For a script to work in your process, assign process variables as input and output to the Script activity. See Set the variable as input and output.
-
To retrieve (get) the value of a process variable for use within a script, add the variable as an input variable.
-
To change (set) the value of a process variable within a script, add the variable as an output variable.
TotalAgility can validate and run a script without requiring the script developer to build and deploy .NET assemblies. The .NET compliance of TotalAgility reduces development time and increases the ease of deployment.
The following is an example of a VB .NET script:
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 FirstName
Dim LastName
FirstName = sp.InputVariables("FirstName")
LastName = sp.InputVariables("LastName")
sp.OutputVariables("Fullname") = FirstName + LastName
End Sub
End Class
End Namespace
In this sample VB .NET script, FirstName and LastName are input variables. The value of these variables is used to construct the value of the FullName variable, which is an output variable.
The following is an example of a C# script:
using System;
using Agility.Server.Scripting.ScriptAssembly;
namespace MyNamespace
{
public class Class1
{
public Class1()
{
}
[StartMethodAttribute()]
public void Method1(ScriptParameters sp)
{
string firstName = sp.InputVariables["firstname"].ToString();
string surname = sp.InputVariables["surname"].ToString();
sp.OutputVariables["fullname"] = firstName + " " + surname ;
}
}
}