Creating Batch Workflow Applications
To create batch workflow applications:
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
-
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:
-
Define a process type definition.
PeopleSoft ships with the process types for PeopleSoft Application Engine already defined, so you can bypass this step.
-
Create a process definition.
-
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.
-
-
Users can then schedule the process just as they schedule any process:
-
Navigate to the page.
-
Click the Run button to reach the Process Scheduler request page.
-
Click Run to initiate the process.
-
-
Test the application.