If you have a comment on this topic, contact Aptify Documentation. If you want to return to the Aptify Community Site, please click here.

Writing Process Flow Step Rules

This topic provides an overview for how to write a Rule for a Process Flow Step. It assumes that you are familiar with writing complex SQL statement and VB.NET scripts.

See Administering Scripts for information on using scripts in Aptify.

 

SQL Rule

Follow these steps to define a Process Flow Step using a SQL statement:

  1. Add a Rule step to the Process Flow diagram.
  2. In the Properties area, enter a Name for the step.
  3. Click the Rule tab and select SQL as the Rule Type.
  4. Enter the SQL statement that performs the operation required by your process flow design. Keep in mind the following:
    • The Script toolbar icons are not applicable to SQL rule types. They are only applicable to VBScript rules.
    • Any values required to process the rule will need to be retrieved from the Process Flow's Context Object by adding the input to the step's Input Map tab using the Add Map button.
    • To add input variables to your SQL script, you can use Aptify's alias syntax for fields, which is in this format: <%[field name]%>.
    • Typically, a SQL rule is used to test a particular condition for a record in the database. In this case, use a SELECT CASE statement to define results for the process flow step. You then add these possible results to the step's Action Map tab using the New Map button to specify the next action when a the SQL rule selects a particular result.
    • See the figure below for a sample SQL rule that uses a SELECT CASE option that returns two possible results: Admin if a particular user is a system administrator and Not_Admin if not.

      SQL Rule

  5. Click the Rule's Properties tab and add any input values required by the rule to the step.
    • Click the Add Map button to add a new input map row and configure the Source Type and Source.
    • If the Source Type for an input is Context Object, then the Input Property either must be defined as a Process Flow Input Property (see Defining Process Flow Input Properties) or must be an output value from a previous step in the Process Flow.
    • The figure below illustrates an input map added for the ID field for the SQL rule shown in the figure above.

      Rule-Based Input Map

  6. Click the Rule's Action Map and add the possible results that the SQL statement can select and specify the next action that should occur when that result is returned.
    • In general, you want to perform this step later after you have created the next steps for your process flow. You can also use Result Code Link option to automatically create new Action Maps that lead to another step in the process flow (however, Action Maps that end the process need to be created manually).
    • See Linking Process Flow Steps Together for more information on the Result Code Link option and for information on configuring the Action Map tab, as well as the requirement for specifying a Process Flow Result Code for each Action Map.

  7. Save the Process Flows record to save your SQL Rule step.

VBScript Rule

Follow these steps to define a Process Flow Step using a VB.NET script:

  1. Add a Rule step to the Process Flow diagram.
  2. In the Properties area, enter a Name for the step.
  3. Click the Rule tab and select VBScript as the Rule Type.
  4. Click the buttons in the Script toolbar to review the set of intrinsic Available Objects that you can use directly in the script, the set of available object you can reference within the script, and any available examples.

    Blank Script Control

    • For Process Flow Step VBScripts, the following objects are defined and available for use:
      • oDataAction: This corresponds to the Aptify.Framework.DataServices.AptifyDataAction class. A developer uses this class in a Process Flow script to retrieve values from the database. See the Aptify Software Development Kit (SDK) for more information on this class.

      • oProperties: This corresponds to the Aptify.Framework.Application.AptifyProperties class. A developer uses this class in a Process Flow script to retrieve from and add to the process flow's Context Object. See the Aptify SDK for more information on this class.

      • oResultCode: This corresponds to the Aptify.Framework.BusinessLogic.ProcessPipeline.ResultCode class. A developer uses this class in a Process Flow script to define Result Codes for this step. See the Aptify SDK for more information on this class.

    Available Objects for Validation Scripts

    • Process Flow Scripts can include references to the following .NET assemblies in the Global Assembly Cache (GAC Reference) or in the Aptify Object Repository (Repository Reference):
      • System: .NET framework assembly.

      • System.Data: .NET framework assembly.

      • System.XML: .NET framework assembly.

      • Bootfiles.IAptifyDataServices: This assembly corresponds to the Aptify.Framework.DataServices namespace, which forms Aptify's Data Services Layer and which is responsible for accessing data from the database. See the Aptify SDK for more information on this namespace. 
        • Note that Bootfiles identifies the Object Package for this assembly in Aptify Object Repository.

      • Bootfiles.AptifyAttributeManagement: This assembly corresponds to the Aptify.Framework.AttributeManagement namespace, which contains classes that are responsible for creating, retrieving, and changing code level attributes. See the Aptify SDK for more information on this namespace. 
        • Note that Bootfiles identifies the Object Package for this assembly in Aptify Object Repository.

      • Bootfiles.AptifyGenericDataServices: This assembly corresponds to the Aptify.Framework.DataServices.DataAction class, which is the main Data Services Layer class used for all synchronous data access for applications developed within Aptify. The DataAction component also manages connections and data caching intrinsically. This class is not bound to a specific database engine. Hence, the Generic nomenclature. Through configuration information, the generic Data Services Layer binds to a specific database engine. The default implementation is for Microsoft SQL Server which is contained in the assembly, AptifySQLDataServices. See the Aptify SDK for more information on this class. 
        • Note that Bootfiles identifies the Object Package for this assembly in Aptify Object Repository.

      • Bootfiles.AptifyUtility: This assembly corresponds to a set of classes in the Aptify.Framework.Application namespace. The objects in this namespace provide a set of utility functions that are used primarily to access metadata associated with entities. See the Aptify SDK for more information on this namespace. 
        • Note that Bootfiles identifies the Object Package for this assembly in Aptify Object Repository.

      • Startup.AptifyProcessFlowEngine: This assembly corresponds to the Aptify.Framework.BusinessLogic.ProcessPipeline namespace, that contains objects related to Aptify's Process Pipeline functionality. This includes the Process Flows Engine that executes process flows as well as the Aptify Asynchronous Processor, which is used by Application Servers to execute asynchronous process flow runs. See the Aptify SDK for more information on this namespace. 
        • Note that Startup identifies the Object Package for this assembly in Aptify Object Repository.

      • Bootfiles.AptifyExceptionManagement: This assembly corresponds to the Aptify.Framework.ExceptionManagement namespace, which contains classes that can be used to manage the persisting of and display of Exceptions throughout an application. See the Aptify SDK for more information on this namespace. 
        • Note that Bootfiles identifies the Object Package for this assembly in Aptify Object Repository.

      • Startup.Aptify Application Object: This assembly corresponds to the Aptify.Framework.Application namespace. The objects in this namespace provide a set of utility functions that are used primarily to access metadata associated with entities. This includes information about attachments, entity actions, entity attributes, views, sub-types, and other entity metadata. Many of the methods provided by the classes in this namespace are convenient substitutes for common SQL queries. For example, rather than writing a SQL query to obtain the Entity ID of the Persons entity, a developer can use the GetEntityID method of the AptifyApplication class. In addition to convenience, the use of the Aptify.Framework.Application objects enforces consistency on development activities by providing a common set of functions that all developers can use from any project. See the Aptify SDK for more information on this namespace. 
        • Note that Startup identifies the Object Package for this assembly in Aptify Object Repository.

      • Startup.Generic Entity Base: This assembly corresponds to the Aptify.Framework.BusinessLogic.GenericEntity.AptifyGenericEntityBase class. This is the base class for the Aptify Generic Entity, the main business object in Aptify. See the Aptify SDK for more information on this class. 
        • Note that Startup identifies the Object Package for this assembly in Aptify Object Repository.

      • Startup.AptifyScriptEngine: This assembly corresponds to the Aptify.Framework.Scripting namespace, which corresponds to Aptify's Scripting engine that executes scripts written for functional areas such as Message Parts, Field Level Validation, and Process Flows. See the Aptify SDK for more information on this namespace. 
        • Note that Startup identifies the Object Package for this assembly in Aptify Object Repository.

      • Bootfiles.AptifyObjectRepository: This assembly corresponds to the Aptify.Framework.ObjectRepository namespace, which contains the objects that define the operation of Aptify's Object Repository. See the Aptify SDK for more information on this namespace. 
        • Note that Bootfiles identifies the Object Package for this assembly in Aptify Object Repository.

          All References for Validation Scripts 
  5. Using VB.NET syntax, write a script that provides the logic required for this process flow step.
    • As you type within the script control, IntelliSense automatically displays a set of available options to assist you with completing an object reference.

      IntelliSense to Complete References

    • The full text of a sample script is shown in the figure above.
      • This rule opens a message box that displays The value provided [value] is < 100.
      • The value included in the message box corresponds to DemoValue, which is an Input Property for the Process Flow. The oProperties.GetProperty method retrieves the DemoValue from the Process Flow's Context Object.
      • After displaying the message box, the script calls oResultCode.Value=SUCCESS to create an Action Map result (called SUCCESS) for the step.
      • See the rule-based steps included with Aptify's delivered Process Flows for more examples. (See Process Flows as Delivered on page 200 for more information about these Process Flows.)

        Sample VBScript Rule

  6. Click the Rule's Properties tab and add any input values required by the rule to the step.
    • Click the Add Map button to add a new input map row and configure the Source Type and Source.
    • If the Source Type for an input is Context Object, then the Input Property either must be defined as a Process Flow Input Property (see Defining Process Flow Input Properties) or must be an output value from a previous step in the Process Flow.
    • Figure below illustrates an input map added for the DemoValue field for the VBScript rule shown in above figure.

      Rule-Based Input Map

  7. Click the Rule's Action Map and add the possible results that the VBScript can generate (based on the oResultCode.Value options you defined) and specify the next action that should occur when that result is returned.
    • In general, you want to perform this step later after you have created the next steps for your process flow. You can also use Result Code Link option to automatically create new Action Maps that lead to another step in the process flow (however, Action Maps that end the process need to be created manually).
    • See Linking Process Flow Steps Together for more information on the Result Code Link option and for information on configuring the Action Map tab, as well as the requirement for specifying a Process Flow Result Code for each Action Map.

  8. Save the Process Flows record to save your VBScript Rule step.

Copyright © 2014-2019 Aptify - Confidential and Proprietary