Managing user exits
When creating user exits, make sure that the script follows the required source code template or signature to enable the application to recognize and execute them.
These scripting languages are supported:
- .NET (any .NET language, C#, Visual Basic, F#)
- VBScript
- JavaScript
These are source code templates or signatures for each language:
- .NET
using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Text; using System.Threading.Tasks; using Ird.SC.Arp.Assortment.UserExits; using System.IO; namespace SampleUserExits { [InheritedExport(typeof(IOperation))] [ExportMetadata("Id", "86fa59f4-483e-4cdf-908f-dd2704311d4e")] //Unique Id for the UserExit, use GUID [ExportMetadata("Name", "My User Exit in C#")] //Display Name for the User Exit [ExportMetadata("Description", "This is a sample UserExit written in C#")] //The description for the User Exit public class MyUserExits : IOperation { #region IOperation Members //This Execute() method is called every time you run a User Exit. public object Execute(params object[] args) { //Retrieve and assign the parameters passed to a Dictionary key pair value object. Dictionary<string, object> parameters = args[0] as Dictionary<string, object>; // return the value in decimal type return <value>; } #endregion } }
- JavaScript
var Id, Name, Description, Args Id = "9d43780a-2eb8-425d-a1c9-8dc189758878"; //Unique Id for the Script, use GUID Name = "UserExit using JavaScript scripting"; //Display Name for this User Exit Script Description = "This is a UserExit using JavaScript scripting"; //Description for the Script Args = []; //This will hold the parameters //This Execute() method is called everytime you run a UserExit, do not remove. function Execute() { var result; //return the value. return result; }
- VBScript
Dim Id, Name, Description, Args Id = "206eeb59-d83b-4459-aec1-3e7b6bd78fbe" '* Unique Id for the Script, use GUID Name = "UserExit using VBScript scripting" '* Display Name for this Plugin Script Description = "This is a sample User Exit using VBScript" '* Description for the Script '* This will hold the parameters Set Args = CreateObject("Scripting.Dictionary") '* This Execute() method is called everytime you run a UserExit, do not remove. Function Execute() Execute=FormatNumber(123.456) '* Always set the Args variable to Nothing after using it. Set Args = Nothing End Function