Templates for scripts

The forms for workflows, copy methods, and equations include templates for new scripts in an object coded @DFLT. The template uses the script language specified in the Language field. However, the language can be changed only if the correct template code is provided.

Note: 
  • Symbol scripts exclude the @DFLT template because function content changes. You can add a script only when a function is required. For functions that apply to each symbol see, Scripts for Optiva object events
  • The specific class name in the library needs to be updated to match the Script code

For all script types, you specify the script within the main function(s) in the template.

VisualBasic.Net example function C# example function

Function execute() as long

End function

public long execute()
    {
        <your code here>
    }

These scripts provide initial script structures for both languages.

Script type VisualBasic.Net C#

Equation

Option Strict Off
imports System
imports System.Diagnostics

Class EquationScript
 Inherits FcProcFuncSetEQ

Function evaluate() As Long

	' Example to load the parameter's new value
	Context.ReturnValue = "0"

	Return 1
End Function

End Class
using System;
using Formation.Shared.Defs;
using System.Data;
using System.Collections;
using System.Xml;

class EquationScript : FcProcFuncSetEq
{

    public long evaluate()
    {
        // Example to load the parameter's new value
        Context.ReturnValue = "0";

        return 1;
    }
}

Action

Option Strict Off
Imports System
Imports System.Diagnostics


Class ActionScript
 Inherits FcProcFuncSetEventWF

Function wf_start() As Long
End Function

Function wf_return() As Long
End Function

Function wf_complete() As Long
End Function

Function wf_approve() As Long
End Function

Function wf_reject() As Long
End Function

Function wf_edit() As Long
End Function

Function wf_view() As Long
End Function

Function wf_reassign() As Long
End Function

Function wf_receipt() As Long
End Function

Function wf_hold() As Long
End Function

End Class
using System;
using Formation.Shared.Defs;
using System.Data;
using System.Collections;
using System.Xml;

class ActionScript : FcProcFuncSetEventWF
{

    public long wf_start()
    {
        return 1;
    }

    public long wf_return()
    {
        return 1;
    }

    public long wf_complete()
    {
        return 1;
    }

    public long wf_approve()
    {
        return 1;
    }

    public long wf_reject()
    {
        return 1;
    }

    public long wf_edit()
    {
        return 1;
    }

    public long wf_view()
    {
        return 1;
    }

    public long wf_reassign()
    {
        return 1;
    }

    public long wf_receipt()
    {
        return 1;
    }

    public long wf_hold()
    {
        return 1;
    }

}

Script Library (replace <SCRIPT_NAME> with the actual Library code)

Option Strict Off
Imports System
Imports System.Diagnostics

Public Class <SCRIPT_NAME>

Private co As FcProcFuncSetEvent

Public Sub New(ByRef context As FcProcFuncSetEvent)
	co = context
End Sub
    'add custom functions as needed
Function wf_call() As Long
	co.MessageList("Hello World!")
	Return 1
End Function
End Class
using System;
using Formation.Shared.Defs;

public class <SCRIPT NAME>
{
    private FcProcFuncSetEvent co;

    public <SCRIPT NAME> (ref FcProcFuncSetEvent context)
    {
        co = context;
    }
            //add custom functions as needed
    public long wf_call()
    {
	co.MessageList("Hello World!")
	return 1;
    }
}

Symbol

Option Strict Off
imports System
imports System.Diagnostics
imports System.Data

Class HookScript
 Inherits FcProcFuncSetEventHook

Function Presave() as long

End Function

'Add event functions as appropriate

End Class
using System;
using Formation.Shared.Defs;
using System.Data;

class HookScript : FcProcFuncSetEventHook
{

    public long Presave()
    {
        return 1;
    }
//Add event functions as appropriate

}