Creating Batch Workflow Applications

This section provides an overview of how to create batch workflow applications.

To create batch workflow applications, you must be familiar with PeopleSoft Application Designer, and you must understand how to create Application Engine programs, component interfaces, and workflow applications.

This section provides a high-level overview of the process.

To create batch workflow applications:

  1. Create the workflow application.

    Build workflow maps, events, routings, and TriggerBusinessEvent PeopleCode. Everything must be working for a batch program to trigger the workflow event.

  2. Create a new record to use as the state record for the new Application Engine program. This record type can be either derived or a table.

    Note: If you are converting a database agent (a technology used in previous PeopleSoft versions), this record contains the database agent input and output fields, that is, the fields on the page where you ran the database agent and the fields that were returned by the database agent query.

  3. Create a new Application Engine program.

    Define the state record that you created in step 1 as the default state record for the Application Engine program. Insert a SQL statement to select values from the run control record into the state record. PeopleSoft Application Engine automatically initializes the OPRID and RUN_CNTL_ID fields.

  4. Create a step in the Application Engine program to select data that meets your conditions.

    This step consists of a PeopleCode program with a SQL query that selects the data. For example, if you are looking for invoices that are over a month old, write a SQL query to select the appropriate invoices.

    You might want to break the SQL query into separate statements if the data is passed to a component interface with multiple levels.

    Note: If you are converting an existing database agent (a technology used in previous PeopleSoft versions), in most cases you can paste the SQL from the database agent query into the Application Engine statement with only minor modifications.

  5. Create the component interface for the component with the Workflow PeopleCode.

    When you create the component interface, expose the properties that the Application Engine program will update.

    Be sure to test the component interface in the interactive environment provided by PeopleSoft Application Designer.

  6. Create an Application Engine step that invokes the component interface once for each row that is returned by the query.

    How you invoke the component interface depends on what you’re trying to accomplish. Here are some general guidelines:

    • Remember the mode that you are using for the component. If you are using Add mode, then use the Create and Save methods on the component interface. If you are using Update/Display mode, use the Get and Save methods on the component interface.

    • On the Save method, you should record errors to a file or record. Workflow PeopleCode triggers routings when the component successfully saves.

  7. Create a process definition for the new Application Engine program and link to the run control page.

    The steps for scheduling an Application Engine program are the same as those for any PeopleSoft Process Scheduler process:

    1. Define a process type definition.

      PeopleSoft ships with the process types for PeopleSoft Application Engine already defined, so you can bypass this step.

    2. Create a process definition.

    3. Set up the page and component where users will run the process.

      If the program includes runtime bind variables, the page must include fields where users can enter values for the variables.

  8. Users can then schedule the process just as they schedule any process:

    1. Navigate to the page.

    2. Click the Run button to reach the Process Scheduler request page.

    3. Click Run to initiate the process.

  9. Test the application.

To trigger routings based on a nonuser-initiated event:

  1. Write a SQL program that checks the database for data that must be processed.

  2. Put the SQL program into an Application Engine program.

  3. Use PeopleSoft Process Scheduler to schedule the Application Engine program to run on a regular schedule.

When the condition for which you’re checking is true, the Application Engine program sends the data to the component interface, which initiates a workflow event. After you’ve started the Application Engine program, no user intervention is required.