Show / Hide Table of Contents

    VBScript Scripting

    Overview

    Processware supports VBScript for defining the runtime functionality on activities, object groups and objects, a natural choice when considering that VBScript is an interpreted language and changes made to scripts are much simpler to deploy when compared to some of the more modern languages available. Processware adds predefined placeholders that are replaced before the VBScript scripts are executed, and inserts constructs to VBScript to support process flow, integration into line of business applications, as well as ways to interact with the visual (and non-visual) aspects of rendered activity instances. Several additional context-specific VBScript variables are also evaluated at runtime, and are considered the output following the execution of these scripts (when and where applicable).

    “avar1”

    This VBScript string value originated as a placeholder to denote an empty object value.

    How do I test an object for empty values

    Start by replacing "avar1" with an empty string, and continue from there (aObjects is described later):

    ' Replace one empty value for another.
    actualValue = Replace("aObjects"(ObjectName)")", "avar1", "")
    if actualValue = "" Then
    ' Do something with nothing
    Else
    ' Value specified.
    End If
    
    Tip

    Create a Business Rule that can be used to verify whether an object’s value is empty, and that can additionally return a default value instead of an empty value.

    aObjects

    The aObjects, for activity objects, VBScript placeholder indicates the location (implicitly as placeholder) in the associated VBScript to be replaced by some value as stipulated. The entire text value, aObjects("Specification") will be replaced according to the specification before the execution of the associated VBScript. The specification references an object on an activity by name, whose value at that specific point in time is to be used to replace the text value. The specification can optionally include an operation (“SUM” specifically) followed by a period prefixing a grouped object’s name to indicate that the text is to be replaced by the specific operation performed on all the values of that object.

    It is worth re-iterating that the entire text value will be replaced as-is; if the value is, e.g., the Boolean value True (as is the case for a selected Radio Button), the text

    selected = "aObjects("...")"
    

    becomes

    selected = "True"
    

    prior to the execution of the resulting VBScript. Knowing this should aid in updating the following

    selected = "aObjects("...")"
    If CBool(selected) Then ' Do something.
    

    to simply

    ' Dropping the quotation marks removes the need for the cast.
    If aObjects("...") Then ' Do something.
    

    as it will be replaced before execution to

    ' Dropping the quotation marks remove the need for the cast.
    If True Then ' Do something.
    

    aObjects, as already stated, is used to populate some VBScript with the value of some object (at the point of execution). aObjects can access ungrouped objects on the same activity instance and any instance that preceded the current one in the same process instance, but only grouped objects can access the values of other objects in the same object group using aObjects.

    fcBR and fcBRV

    The fcBR and fcBRV VBScript placeholders are expanded prior to the execution of the VBScript to evaluate a Business Rule or access the value of a Business Rule Variable, respectively, as maintained and deployed by the designer. The Business Rules are typically compiled down to a Microsoft.NET type called BusinessRules in an assembly (typically FlowCentric.Net.BusinessRules.dll, under the DynamicExecution folder on the associated Activity Server). A Business Rule used in some VBScript, say

    result = fcBR.BR1(param1,...,paramN)
    

    will typically be expanded to reflect the call to the corresponding method, as in:

    result = businessRules.BR1(Array(param1,...,paramN))
    

    With businessRules an instance referencing the type (and the VBScript Array function used to group the parameters).

    The Business Rule Variables are deployed to and maintained by the Activity Server as a global collection of named values, and a specific variable, say,

    value = fcBRV.BRV1
    

    will typically be expanded to reflect accessing the value, as in:

    value = businessRules.GetVariable("BRV1")
    

    Similarly, changing the value of a modifiable Business Rule Variable will be translated accordingly, typically as,

    businessRules.SetVariable("BRV1", value)
    
    Tip

    Refer to the BusinessRules property for the equivalent of the above in Managed Code.

    fcConn

    fcConn is a VBScript string variable that is evaluated by the engine on some VBScript scripts to output an OLEDB-based connection string referencing an associated data store. This variable is usually accompanied by another context-specific VBScript string variable denoting some query (fcSQL) or command (fcDBCommand) to be executed on the specified data store. fcConn is available on the Dynamic Value VBScripts associated with objects, the Trigger VBScripts for Command Options, and on the Data Source VBScripts of Browse Pages.

    To see how to set fcConn, please refer to the section How do I retrieve a configured custom connection string?

    fcSQL

    fcSQL is a VBScript string variable available only on the Dynamic Value VBScripts of objects that is interpreted at runtime in conjunction with fcConn, directing the runtime accordingly to retrieve the object-specific data. Object-specific in the sense that the data is a collection of selectable items when used on Lookup (see here in particular), Drop Down and Team Select objects, and single result (so-called scalar) values for the remaining objects.

    fcDBCommand

    fcDbCommand is a VBScript string variable that can be populated with SQL commands to be executed by the engine once the Trigger VBScript completes in conjunction with the completion of the associated activity instance. It is required that the fcConn VBScript string variable is also populated as the SQL commands need to execute against a specific data store. The SQL commands mostly codifies changes to be made to custom data stores as the result of the completion of (or to reflect the state associated with) an activity instance. As an example, the SQL commands might codify the actions to be performed once an approval instance has been completed. Even though these commands can be executed in a variety of ways, having the engine execute them has one major benefit.

    The engine maintains a logical transaction when executing the Trigger VBScript associated with a Command Option to manage an instance’s transition to its state of completion. When any error occurs the engine needs to transition the instance to its previous state. As there is no explicit compensation functionality available to allow the executed Trigger VBScript to undo any external integration performed, solutions built can get into various states of inconsistency. To alleviate this situation, the engine provides the ability to rollback custom database modifications when fcDbCommand (and fcConn) is used. The server setting for enabling this is called EnableTransactionOnTrigger.

    Warning

    Custom modifications to the Processware database, and especially the database tables relating to the runtime engine, should be avoided at all cost. There are a number of scenarios where deadlocks will occur when these tables are altered, especially during the execution of the Trigger VBScript of Command Options.

    fcLabel

    fcLabel is the VBScript string variable available on the Dynamic Value VBScripts of all objects signifying the resulting values to be associated with the associated objects. fcLabel is also available on the Dynamic Description VBScript of activities, where it is used to dynamically populate the resulting (language-agnostic, as opposed to fcDescription) runtime description of the activity, overriding the static design-time description of the activity.

    How do I set the language-agnostic runtime description of an activity

    The following example shows how to set the runtime description of an activity dynamically, including the participant’s full name (using fcCurrentUser) and the full date and time (formatted using fcCustomFunctions).

    fcLabel = "Requested by " & fcCurrentUser.FullName & " (" & fcCustomFunctions.FormatDate(Now, "{0:F}") & ")"
    

    fcDefaultTo

    fcDefaultTo is another VBScript string variable available on the Dynamic Value VBScripts of (only some of the) objects, that directs the engine to a default value for the object that is to be used if no other value is provided (either directly by a user or indirectly through other VBScript scripts). It is used in the same way as fcLabel:

    fcDefaultTo = "This is a default value"
    

    fcDescription

    fcDescription is the VBScript string variable only available on the Dynamic Description VBScript of activities, used to calculate the dynamic language-specific (as opposed to fcLabel which is language-agnostic) description of an activity, overriding the static design-time description of the activity.

    How do I set the dynamic language(s)-specific runtime description(s) for an activity

    In the following example, the runtime description of the activity is set using a language (or resource)-specific custom format (such as, “Requested by {0} ({1:F})”, in the default language, but translatable to other languages) applied to the current participant’s full name (using fcCurrentUser) and the current date and time.

    Set currentResources = fcContext.Resources.Current
    fcDescription = currentResources.Format(currentResources.GetStringResource("Descriptions", "RequestFormat"), Array(fcCurrentUser.FullName, Now))
    

    This dynamic description will be evaluated by the engine for each configured language, resulting in a collection of dynamic descriptions, one per language, and displayed as applicable to all participants in the process instance.

    Tip

    Try to always use the fcDescription based approach, even if there are no additional languages available yet, as it is far simpler than trying to retrofit at a later stage.

    fcTrigger

    fcTrigger is a VBScript string variable that is interpreted by the runtime following the execution of the Trigger VBScript of a Command Option. It describes the outcomes, including the steps that are to follow, or one or more error messages, relating the current state of an activity instance in the context its containing process instance, with the action represented by the selected Command Option.

    Tip

    As fcTrigger is a string variable, the normal operations for variables of this type is available, such as concatenation, etc.

    fcTrigger = ""
    ' ...
    fcTrigger = fcTrigger & stringValue
    

    How do I communicate errors from a Command Option

    As the Command Option is to validate the state of the current activity instance (in the context of its process instance), it is often necessary to communicate errors back to the originating user. The fcTrigger variable enables this in one of two ways:

    a) Directly, prefixing an error message with the “ERR:” text value

    fcTrigger = "ERR: An error message detailing some condition preventing the completion of this instance."
    

    b) Indirectly, by providing a lookup key for a multi-lingual error message. The fcContext VBScript object is available to the Trigger VBScript on command options, and by using the Resources property on fcContext it is possible to create language-aware error messages. When the error messages are static and not defined with external input (such as format strings), a much simpler way to communicate an error message is by prefixing it with the text “99999” (five nines, no spaces), as in:

    fcTrigger = "99999" & "ErrorResource"
    

    (the two string parts are split for the sake of readability).

    The key, ErrorResource in this case, maps to the name of a Custom Resource under the resource set named CustomErrorMessages in the Language Editor.

    LanguageEditor

    How do I complete the current activity instance

    Once all validation is done, the current activity instance can be completed. The fcTrigger variable details the steps going forward, and has the following (fixed positioning) format:

    fcTrigger = "activityName"                                             & _
    ":" & fcCustomFunctions.FormatDate(dueDate, "yyyy/MM/dd HH:mm")        & _
    ":" & fcCustomFunctions.FormatDate(activationDate, "yyyy/MM/dd HH:mm") & _
    ":" & participantName                                                  & _
    ":" & numberOfNotifications                                            & _
    ":" & notificationInterval                                             & _
    ":" & "name1=value1" '[;name2=value2;...;nameX=valueX]
    
    Separator Part (string) Description
    Activity Name Name of the activity to succeed this one in the process instance. Leaving this empty results in a completed process instance branch (where a branch is the directed path from the current activity instance to the first instance that started the process), and once all branches are complete, the process instance will be archived.
    : Due Date A date (and optionally time) value indicating when the instance of the activity with the specified name should be completed. An activity instance with a due date can be presented by clients with a traffic light indicating the current system date relative to the due date (e.g. with a red light indicating an instance that is past its due date, and green to indicate that there are still some time left for completing the instance). Note: The expected format for this date value is: yyyy/MM/dd HH:mm - the time value is 00:00 if not specified indicating that the activity is due on the start of the associated day. Note: The Notification & Escalation Service is responsible for sending out notifications, and a Due notification will be send by the service once the due date expires.
    : Activation Date A date (and optionally time) value future to the current system time for when the instance of the activity with the specified name is to become active. Although the instance is created immediately as the previous one completes, these instances can be hidden from participants for a time by specifying a future activation date, from which point it will be available to participants for completion. Note: The expected format for this date value is: yyyy/MM/dd HH:mm - the time value is 00:00 if not specified indicating that the activity is active on the start of the associated day. Note: The Notification & Escalation Service is responsible for sending out notifications, and a New notification will be send by the service once the instance is active.
    : Participant Name The name of the Role that is to complete the instance of the activity with the specified name. It is also possible to specify the name of a Role Group to participate, if there is no Role with the same name (that is, Roles take priority over Role Groups). Note: This value overwrites the Creation Type specified on the referenced activity.
    : Number of Notifications The number of notifications to be send before the uncompleted instance is escalated. Note: This value overwrites the Number of Notifications specified on the referenced activity. Note: The Notification & Escalation Service is responsible for sending out notifications, and escalating instances once this number has run out.
    : Notification Interval The frequency (in hours) between notifications to be send to an associated participant until the instance is completed. Note: This value overwrites the Notification Interval specified on the referenced activity. Note: The Notification & Escalation Service is responsible for sending out notifications.
    : Task Parameters A collection of named values in the format: name1=value1[;name2=value2] that will be available on the resulting activity instance for further processing.

    The only required part is the name of the next activity to be instantiated (as stated, an empty value completes the process instance branch). The engine will instantiate the activity with the specified name based on its parenting process (and versioning status). If the process parents both this activity and the current instance’s activity, the activity to be instantiated will be the one within the same process (major and minor) version; this allows instances of a specific version of process to run to completion (ignoring other versions thereof). When the parenting process differs from the current instance’s activity, the activity to be instantiated (with the specified name) originates from the parenting process currently marked as the active version.

    The separators are also required to indicate the specific location of a part. The format described above applies to a single instance of a specific activity; to designate more than one instance to follow the current one use the same format as above, separating these with a comma, ','.

    As an example:

    fcTrigger = "activity1,activity2:::Role,activity3::::::param=test"
    

    will result in a process instance split between instances of the three activities named activity1, activity2, and activity3, with the first and third instances assigned to participants as designed on their respective activities (activity1 and activity3), while the second instance is assigned to a specific role (named Role). The third instance is also initialized with task parameters.

    There is also a lesser known feature directing the engine to return a URI to a supporting client that, in turn, will navigate a user accordingly. This is done by prefixing the built fcTrigger string as follows:

    fcTrigger = "[NavigateTo:http://wwww.flowcentric.com]" & fcTrigger
    

    The resulting string value may only have one such absolute (not relative) navigation URI, and it must be the first part of the string, between the braces, [ and ], and using a colon, :, to separate the part named NavigateTo and the actual URI. There is no separator between this and the first fcTrigger-specific activity name.

    Process

    Process is the VBScript object available on all VBScript scripts providing read-only access to information pertaining to the currently running process instance. A process is instantiated during the execution of one of the Command Options on an activity designated as process starter (as in Creation Type set to First Activity).

    Tip

    Refer to the Process property for the equivalent of the below in Managed Code.

    How do I use Process to access process instance related information

    The design-time process description is available using the following:

    description = Process.Description
    

    Once a process is instantiated, its identifier can be accessed in one of the following ways:

    processId = fcBusinessEvent.ProcessId
    processId = Process.Id
    

    This is most commonly used to associate custom data with an instance, to allow tracking changes to process instances.

    Note

    The id is invalidated when any (either validation or other) error occurs in the Command Option of the first (Creation Type set to First Activity) activity.

    Also available on running process instances is the date and time these instances were started:

    startedAt = Process.Date & " " & Process.Time
    

    Process defines a single method that calculates the number of pending activity instances - either all of them or only those with a specific name - in the process instance. This is mostly used to prevent a certain number of process branches, duplicated due to splits, from continuing past a certain point. In the following snippet, all branches that include the activity with the Command Option with the Trigger script specified will be archived, and therefore not continue, until there is only one such branch left and this last branch will be allowed to continue.

    If Process.CountPendingEvents(fcBusinessEvent.Name) = 1 Then fcTrigger = "[NextActivity]"
    

    This effectively 'mimics' a process join - the remainder of the branch will not have direct access to the object values persisted with the other, parallel, branches, as would have been the case with a proper process join.

    And lastly (but in no ways the least), access to the entire branch (that is, all activity instances, starting from the current one all the way the one that started the process instance) is available in XML format using the following:

    currentBranch = Process.Current
    

    This legacy property was used extensively in the past for many integration scenarios.

    fcBusinessEvent

    The fcBusinessEvent VBScript object is available on all but an activity's Dynamic Description VBScript scripts and makes instances of the current activity available to the VBScript on the activity and its containing Object Groups and objects. It provides access to the runtime properties associated with the instance, such as design-time and runtime identifiers, amongst others, and to the properties and values of all objects and Object Groups available on the instance.

    How do I get the identifier of the current activity instance

    The runtime or instance id of an activity can be retrieved as follows:

    id = fcBusinessEvent.Id
    
    Note

    The runtime id on an activity designated as process starter with Creation Type of First Activity) is only accessible in a Command Option, as the instance is only persisted during its completion. The id is invalidated when any (either validation or other) error occurs.

    How do I reference an Object Group in the current activity

    The following snippet shows how to reference an actual Object Group as associated with the current activity:

    controlGroup = fcBusinessEvent.ObjectGroups.NamedItem("ObjectGroupName")
    

    The default Object Group, containing all (non-Command Option) objects that are not explicitly associated with an (actual) Object Group can be referenced as follows:

    controlGroup = fcBusinessEvent.ObjectGroups.Item("0")
    

    Finally, the trigger Object Group containing all Command Options (only) can be referenced as follows:

    controlGroup = fcBusinessEvent.ObjectGroups.Item("-1")
    

    How do I reference an Object in the current activity

    To reference an object in the current activity, its associated Object Group needs to be referenced first (see Reference an Object Group in the current activity) and from this, the object can be retrieved:

    control = controlGroup.Item("ObjectName")
    

    fcCurrentUser

    fcCurrentUser defines a VBScript object that is available on all VBScript scripts providing limited (when compared to the fcContext-based entities) access to the information pertaining to the user currently participating in an activity instance.

    Tip

    Refer to the CurrentUser property for the equivalent of the below in Managed Code.

    How do I use fcCurrentUser

    fcCurrentUser provides access to a participating user’s user name, full name (in “FirstName LastName” format), email address, and role id, description and metadata.

    ' User specific information.
    userName = fcCurrentUser.UserName
    fullName = fcCurrentUser.FullName
    emailAddress = fcCurrentUser.EMail
    ' Role information.
    roleId = fcCurrentUser.RoleID
    roleDescription = fcCurrentUser.RoleDescription
    ' Metadata
    value1 = fcCurrentUser.Metadata(name1)
    ' Update and save.
    fcCurrentUser.SetMetadata(name2, value2)
    fcCurrentUser.SaveMetadata
    

    How do I get the fcContext-specific entities from fcCurrentUser

    Translating to the fcContext-based entities provides far more options, including modification of specific properties. The previous example translated accordingly:

    ' Get the user.
    Set currentUser = _
        fcContext.Data.Company.Users.GetByName(fcCurrentUser.UserName).User
    ' Get the role.
    Set currentRole = fcContext.Data.Company.Users.GetRoles(currentUser).At(0)
    ' Alternatively, by id.
    '    = fcContext.Data.Company.Roles.GetById(fcCurrentUser.RoleID).Role
    ' Get the metadata.
    Set metadata = fcContext.Data.Company.Roles.GetMetadata(currentRole)
    
    ' User specific information.
    userName = currentUser.Name
    fullName = currentUser.FirstName & " " currentUser.LastName
    emailAddress = currentUser.EmailAddress
    ' Role information.
    roleId = currentRole.Id
    roleDescription = currentRole.Description
    ' Metadata
    For index = 0 To metadata.Count - 1
      Set roleMetadatum = metadata.At(index)
      If roleMetadatum.Name = name1 Then value1 = roleMetadatum.Value
      ElseIf roleMetadatum.Name = name2 Then
      ' Update and save.
        roleMetadatum.Value = value2
        fcContext.Data.Company.Roles.SetMetadata(currentRole, roleMetadatum)
      End If
    Next
    

    Even though this is considerably more lines of code, the resulting user and role exposes even more functionality not available on fcCurrentUser.

    fcAssemblyHelper

    fcAssemblyHelper is a VBScript object available on all VBScript scripts for including any VBScript-friendly Microsoft.NET type into the script. To be VBScript-friendly, the type(s) to be imported and used must COMVisible (and non-generic) with a public default (parameter-less) constructor. Any input and output parameters to the methods exposed must be simple types (int, string, etc.) or complex types composed of these simple types. fcAssemblyHelper has a single method for importing the type by specifying the name of the assembly, located under the bin folder of the Activity Server, the type and, optionally, the name of the resulting instance of that type (if an instance name is not specified, the type name is used).

    ' Import accordingly
    fcAssemblyHelper.Load "nameOfAssembly", "nameOfType", "nameOfInstance"
    nameOfInstance.Method param1, param2 ', ..., paramN
    

    The benefits of using Microsoft.NET assemblies includes re-usable (and externally tested) code, and the ability to debug these assemblies via Microsoft Visual Studio (Professional Edition and above).

    fcDataBlock

    fcDataBlock is a VBScript object available on the Dynamic Content VBScript of Object Groups, that allows an Object Group to be populated from another source. The typical code for using fcDataBlock looks as follows:

    With fcDataBlock
        .CurrentProcess = Process.ID
        .Company = Process.Company
        ' Source Specification:
        .Filter = "//fcRecord"
        .Mapping.Add "Source1", "TargetObject1"
        .Mapping.Add "Source2", "TargetObject2"
        ' ...
        .Mapping.Add "SourceN", "TargetObjectN"
        fcLineItems = .LineItems
    End With
    

    The sources of the mappings are dependent on the source specification, and the targets are the names of the objects grouped by the Object Group owning the VBScript. The resulting Object Group will have the same number of lines as provided by the filtered source, and the mapping applied to the grouped objects in the Object Group.

    The filter property on fcDataBlock allows for an XSLT-based filter expression to be performed on the output produced to indicate inclusion of specific rows for import into the resulting Object Group, where the default value, //fcRecord, indicates that all resulting rows are to be included.

    How do I populate an Object Group from another Object Group

    The source specification in the initial code (above) needs to reference the Object Group from which to import, which also includes the name of the activity containing the group. The source specification is updated as follows:

    With fcDataBlock
        .CurrentProcess = Process.ID
        .Company = Process.Company
        ' Source Specification:
        .ImportLineItems "ActivityName", "ObjectGroupName"
        .Filter = "//fcRecord"
        .Mapping.Add "SourceObject1", "TargetObject1"
        .Mapping.Add "SourceObject2", "TargetObject2"
        ' ...
        .Mapping.Add "SourceObjectN", "TargetObjectN"
        fcLineItems = .LineItems
    End With
    

    The sources of the mappings are updated to reflect the name of grouped objects in the source Object Group.

    The instance of the activity with the specified name and within the same process instance as the current activity instance, is located by traversing the branch from the current activity all the way to the root instance (that started the process) - the first activity instance found with the specified name will be used. The above can also be used to import from an object group on the same activity.

    Note

    Where aObjects is available to import values of ungrouped objects from preceding activities, fcDataBlock is the only supported way to access the values of grouped objects from preceding activities, and this by importing the values first to grouped objects on the current activity.

    How do I populate an Object Group using rows (so-called record sets) from a database

    The source specification in the initial code (above) needs to specify the OLEDB-based connection string to the data store backing the rows produced by an appropriate query. The source specification is updated as follows:

    With fcDataBlock
        .CurrentProcess = Process.ID
        .Company = Process.Company
        ' Source Specification:
        .ImportRecordSet "OLEDB Connection String", "Source Query"
        .Filter = "//fcRecord"
        .Mapping.Add "Column1", "TargetObject1"
        .Mapping.Add "Column2", "TargetObject2"
        ' ...
        .Mapping.Add "ColumnN", "TargetObjectN"
        fcLineItems = .LineItems
    End With
    

    To specify the OLEDB connection string, please review the section How do I retrieve a configured custom connection string?. The source query, typically a SELECT statement, will be executed on the associated data store and the resulting rows imported based on the column-to-object mappings updated as shown.

    How do I populate an Object Group from a CSV file

    The source specification in the initial code (above) needs to reference a File Attachment object, including the name of the activity containing it, that was used to upload the CSV (comma-separated values) file. The source specification is updated as follows:

    With fcDataBlock
        .CurrentProcess = Process.ID
        .Company = Process.Company
        ' Source Specification:
        .ImportDelimitedFile "ActivityName", "FileAttachmentName", ","
        .Filter = "//fcRecord"
        .Mapping.Add "Field_0", "TargetObject1"
        .Mapping.Add "Field_1", "TargetObject2"
        ' ...
        .Mapping.Add "Field_N-1", "TargetObjectN"
        fcLineItems = .LineItems
    End With
    

    The last parameter indicates the separator that is used to delimit the row values in the file, and is typically a comma (‘,’). The sources of the mappings are updated to reflect the columns in the file, and these columns are indicated by the 0-based-indexed names shown.

    The instance of the activity with the specified name and within the same process instance as the current activity instance, is located by traversing the branch from the current activity all the way to the root instance (that started the process) - the first activity instance found with the specified name will be used.

    How do I populate an Object Group from XML

    The source specification in the initial code (above) needs to provide the XML content (as VBScript string), as shown next:

    With fcDataBlock
        .CurrentProcess = Process.ID
        .Company = Process.Company
        ' Source Specification:
        .ImportXML xmlContent
        .Filter = "//fcRecord"
        .Mapping.Add "ElementName1", "TargetObject1"
        .Mapping.Add "ElementName2", "TargetObject2"
        ' ...
        .Mapping.Add "ElementNameN", "TargetObjectN"
        fcLineItems = .LineItems
    End With
    

    The sources of the mappings are updated to reflect the (repeating) XML element names that will contain the text content to be imported into the resulting Object Group.

    How do I populate an Object Group using Microsoft.NET

    fcDataBlock supports importing from a Microsoft.NET DataSet or DataTable (from the System.Data namespace), as well as from implementations of so-called source providers. The source specification in the initial code (above) needs to instantiate and assign the type that is to act as source provider, as shown next:

    fcAssemblyHelper.Load "CustomAssembly", "CustomProvider", "provider"
    ' From provider as source-provider
    Set source = provider
    ' From provider returning Microsoft.NET System.Data.DataSet ...
    ' Set source = provider.GetDataSet()
    ' ... or System.Data.DataTable
    ' Set source = provider.GetDataTable()
    
    With fcDataBlock
        .CurrentProcess = Process.ID
        .Company = Process.Company
        ' Source Specification:
        .ImportFrom source
        .Filter = "//fcRecord"
        .Mapping.Add "Column1", "TargetObject1"
        .Mapping.Add "Column2", "TargetObject2"
        ' ...
        .Mapping.Add "ColumnN", "TargetObjectN"
        fcLineItems = .LineItems
    End With
    

    The resulting rows are imported based on the column-to-object mappings updated as shown.

    EmployeeLookup

    The EmployeeLookup VBScript directive has the sole purpose of populating its encapsulating Lookup with the full names of the Users in a specific Role Group. This is typically used (and useful) in scenarios where some activity succeeding the current instance is configured with Creation Type of Object Value referencing the current Lookup. The resulting activity instance will automatically be assigned to the User selected from the Lookup’s resulting collection of selectable items (that is, User full names). In the following example, the complete list of full User names (in the format “FirstName LastName”) for the default Role Group, All Employees, will form the collection of items on a Lookup:

    EmployeeLookup("All Employees")
    
    Note

    The EmployeeLookup must be the only text in the associated VBScript for it to be recognized and used.

    fcBrowseDataSource

    The fcBrowseDataSource VBScript object is available on the 'Data Source' VBScripts of Browse Pages, and is used to specify the source backing the data pages associated with these Browse Pages. A custom .NET type is referenced and instantiated using the fcAssemblyHelper VBScript object, and the DataSet or DataTable retrieved is assigned accordingly, as in:

    fcAssemblyHelper.Load "CustomAssembly", "CustomProvider", "dataProvider"
    fcBrowseDataSource = dataProvider.GetSpecificDataPage()
    

    Where the method can have context-specific parameters provided as necessary.

    The Advanced Browse Pages also supports assigning so-called data-source providers to the fcBrowseDataSource variable, where these providers implement the paging, filtering and sorting functionality required. This is how Integration Entities back Advanced Browse Pages, to allow integration into line of business applications (amongst others) as shown next:

    Set catalog = fcContext.Integration.GetCatalog("LOBCatalog", "1.0")
    Set endpoint = catalog.GetEndpoint("LOBEndpoint")
    Set entitySet = endpoint.GetEntitySet("LOBEntitySet")
    Set fcBrowseDataSource = entitySet.GetDataSourceProvider()
    

    The data-source provider model forms part of the extensibility exposed by the runtime engine, and custom implementations can also be assigned, as in:

    fcAssemblyHelper.Load "CustomAssembly", "CustomProvider", "dataProvider"
    Set fcBrowseDataSource = dataProvider.GetSpecificDataSourceProvider()
    

    fcCustomFunctions

    fcCustomFunctions is a VBScript object available to all VBScript scripts providing some functionality for formatting values and for getting the names of uploaded files.

    How do I format a VBScript Date or Number

    fcCustomFunctions provides as culture-agnostic Microsoft.NET-based formatting functions on VBScript dates (in addition to the culture-specific formatting of VBScript objects handled by specific Resources) the following:

    stringValue = fcCustomFunctions.FormatDate(someDate, format)
    stringValue = fcCustomFunctions.FormatEx(someDate, format)
    

    and on VBScript numbers

    stringValue = fcCustomFunctions.FormatNumber(number, format)
    stringValue = fcCustomFunctions.FormatEx(number, format)
    

    The format specified is as defined by Microsoft.NET for the specific types.

    How do I get the file name uploaded using a File Attachment

    fcCustomFunctions provides the means for retrieving the original file name(s) uploaded using File Attachment objects, and is described on File Attachments.

    fcCustom

    fcCustom is a VBScript Object that, before the days of fcContext, provided the means for accessing single values from custom settings. The snippet presented in the previous section (on custom connection strings) would have been accessed using:

    fcConn = fcCustom.Key(Process.Company,"Connections\CustomDbConnection")
    
    Back to top Copyright © FlowCentric Technologies (PTY) Ltd - Processware Developer Guide