Exercise: Add the Custom Parameter Set Table for the Business Process

Individual parameters are organized into a parameter set. A business process can be designed to accept zero, one, or several parameters. The end user can define multiple parameter sets for a given business process.

Before a business process starts, the end user creates one or several parameter sets, selects a parameter set, and starts the business process instance. With the parameter set for guidance, the business process instance processes the data.

When the business process processing starts, the parameter set values are retrieved and the processing on the data begins in earnest. The parameter set values are stored within a custom database table. For details, see Business Process Parameter Set Table (USR_INVENTORYPROCESS)


Figure: Parameter Sets

Step 1 -  Prerequisites.

Step 2 -  Create an InventoryProcess folder within the catalog project.

Figure: Add the InventoryProcess folder within the catalog Visual Basic project if it does not already exist

Step 3 -  Add a TableSpec to the InventoryProcess folder.

Step 4 -  Identify the table.

At the top of the spec, provide the following values in the TableSpec element to identify the table in the system.

The Name attribute is the friendly name for the table within the system and defines the record type value that the end user see within the user interface. The Tablename attribute defines the database table name. The Tablename attribute value corresponds with the Business Process Spec's ParameterTableName attribute value.

<TableSpec
	xmlns="bb_appfx_table"
	xmlns:common="bb_appfx_commontypes"
	ID="e7d7fadd-b188-4bda-90b0-31b915a66f06"
	Name="Inventory Process Parameter"
	Description="Table to store business process parameters for the inventory business process."
	Author="Technical Training"
	Tablename="USR_INVENTORYPROCESS">

Step 5 -  Define the fields within the table to support the parameters.

An end user relies upon an Add Data Form and Edit Data Form to save parameter data into the custom database table. Add four fields into the Table Spec, one for each parameter. The parameter set this TableSpec supports includes:

Note: When defining a parameter set table, a NAME column or some other column should be used to represent the label for the business process parameter set. This table column corresponds with the BusinessProcessSpec element's ParameterLabelField attribute which is used to identify the name of the field in the parameter table which represents the label for the parameter set. If the ParameterLabelField attribute for the BusinessProcessSpec element is not specified, NAME is used as the default. If the default is used and NAME does not exist on the parameter table, loadspec will throw an error. We recommend you explicitly identify the ParameterLabelField in your business process specs.

  1. A NAME text field is used to label the parameter set

  2. A DESCRIPTION text field to describe the business process instance.

  3. The IDSETREGISTERID foreign key field points to a system table named IDSETREGISTER. Each row in the IDSETREGISTER table corresponds to a view or table-valued function that returns a list of Primary Key ID values of a particular record type (database table), such as Constituent or Revenue. For more information, see a Using a Selection as a Parameter to Restrict the Row Set.

  4. A QueryViewSpec can be used to drive the columns of data also known as the Output Format, which is created as a business process. The QUERYVIEWID foreign key field is used to reference a query view to dictate the output format. For more information, see Using a QueryViewSpec as a Parameter for Output Formatting.

While this exercise highlights the best practice of using a QueryViewSpec to help format the output and a selection to help restrict the row set of a business process, keep in mind you are free to develop whatever parameters you see fit to create your custom solution. You are also free to create any type of output your requirements dictate.

To define the columns for the USR_INVENTORYPROCESS table, add the Fields XML element and its child elements below the TableSpec XML element.

<TableSpec 
	xmlns="bb_appfx_table"
	xmlns:common="bb_appfx_commontypes" 
	ID="e7d7fadd-b188-4bda-90b0-31b915a66f06"
	Name="Inventory Process Parameter"
	Description="Table to store business process parameters for the inventory business process."
	Author="Technical Training"
	Tablename="USR_INVENTORYPROCESS">
	<!-- define fields on the table -->
	<Fields>
		<TextField 
			Name="NAME" 
			Length="100" 
			Required="true" 
			IsUnique="true" 
			Description="The name of the parameter set"/>
		<TextField 
			Name="DESCRIPTION" 
			Length="255" 
			Description="Details describing this parameter set"/>
		<ForeignKeyField 
			Name="IDSETREGISTERID" 
			ForeignTable="IDSETREGISTER" 
			Cardinality="ManyToOne"
			Required="true" 
			OnDelete="CascadeDelete"/>
		<ForeignKeyField
			Name="QUERYVIEWID"
			Cardinality="ManyToOne"
			ForeignTable="QUERYVIEWCATALOG"
			Required="true"/>
	</Fields> 

Step 6 -  Add a trigger to delete related records within BUSINESSPROCESSINSTANCE.

The BUSINESSPROCESSINSTANCE supports the securing of a parameter set for a business process to a particular site and/or selected security roles. Therefore when a row is delete from our custom parameter set table, we need to delete the relate rows within the BUSINESSPROCESSINSTANCE table.