Components of a Workflow Process

A workflow process consists of several components. Expand the apps@vd11 line by clicking on the plus sign (+) inside the Navigator. You will see three item types: PO Approval, PO Standard, and Standard. You will also see a Hidden Item Types icon. Double-click on the Hidden Item 
Types icon to display the same Show Item Types window seen when you open a Workflow file. Expand the menu attached to PO Approval and you will see the six components of the PO Approval. They are:
·       Attributes
·       Processes
·       Notifications
·       Functions
·       Messages
·       Lookup types


Item Types
Item types categorize the items. Each activity in a workflow process must be associated with an item type. To create a new item type, right-click on apps@vd11 and choose New Item Type. In this chapter, the right mouse button is assumed to be the secondary button on your mouse. The Item Type Property window will appear. Enter an internal name for the item type. Type the internal name using uppercase letters. The name can include numeric characters, but cannot contain spaces. You cannot update the internal name once the item type is defined. 

The internal name must be unique across the entire workflow process. The internal name is used in Workflow Engine APIs. Enter a display name next. The display name is what you use to refer to this item type in any activity. You have the option of entering a description and a selector.
A selector is mandatory if your item type is associated with more than one process. The selector returns the process that must be executed in this multiple-process situation. Selector is a PL/SQL stored procedure. Create a new item type called NEW_PO with a display name of NEW PO Item Type (see Figure 3).


Figure 3: Item Type Properties form

The Role tab is designed to let you specify the role that will read, write, and/or execute the item type. (Unfortunately, these security features are not currently active, so you will need to test them in future versions.) Select the Access tab. The red bar, shaded or crossed, represents the access level that can edit objects in the Oracle Workflow Builder.

A black vertical bar identifies your access level. You can select combinations of the two options to preserve customizations and lock in at this access level, or to generate different access levels. If both options are checked, you can see that the three levels—Customization, Access, and Protection—are all at 100. This means that only your current access level (100) can update objects. If only the Preserve Customizations option is checked, customization and access are both at level 100 while protection is at level 1000. This means access levels 100 to 1000, equal to or higher than your current access level, can update objects.

If the Lock at this Access Level option is checked, the customization level is at 0 and both access and protection levels are at 100. This means that access levels 0 to 100, equal to or lower than your current access level, can update objects. If neither option is checked, any access level can update objects. Customization is at level 0 and protection is at level 1000.
The red bar will have a crossed pattern if Allow modifications of customized objects is checked. To find this option, execute the Help | About Oracle Workflow Builder menu command. If you checked Allow modifications of customized objects, you can modify and save objects even if your access level is outside of the customization and protection range. Check Allow modifications of customized objects. You must exit the New Item Type properties window to do this. Click OK to save your definition.

Once you have checked the box under the Help menu, open the Item Type properties window again. Notice that you cannot change the internal name field anymore. Click on the Access tab and check both the Preserve Customizations option and the Lock at this Access Level option (see Figure 4). Click on OK to save your changes.


Figure 4: Item Type Properties (Access Tab) form

Attributes
All items that have the same item type share the same set of attributes. Attributes are information and properties regarding the item type. Each item will have its own set of attribute values. Attributes are similar to global variables in that they can be used by any activity in the workflow process. Workflow Engine APIs allow you to get or set attribute values for an item.
Double-click on the attribute to see the properties of the activity. If you want to add a new attribute, right-click when your cursor is on the Attributes icon and choose New Attribute. Either way, the Attribute Property window will appear and the item type will be displayed.

If you are creating a new item attribute, enter an internal name for the item attribute. The internal name must be uppercase and unique across the same item type; the name cannot contain spaces. Next, enter a display name. The display name will be used in a message or activity. You can then enter an optional description.
Next, select an attribute type. Valid types are:
·       TextThe attribute value is the text datatype. You can enter an optional length for this attribute type.

·       NumberThe attribute value is the number datatype. You can enter an optional format mask for this attribute type.

·       DateThe attribute value is the date datatype. You can enter an optional format mask for this attribute type.

·       LookupThe attribute value is one of the values specified in a lookup type. You must enter a lookup type for this attribute type.

·       FormThe attribute value is the internal function name used on an Oracle Application form. You can enter optional function parameters for this attribute type. This attribute type is only useful when using Oracle Applications and the Notifications Viewer form. The Oracle Application form will appear in the Notifications Viewer form. You can bring up the Oracle Applications form from the Notifications Viewer form.

·       URLThe attribute value is a Universal Resources Locator (URL) to a Web location. This attribute type is only useful if you have the Notifications Web page. The URL will appear in the Notifications Web page. Select it to bring up the Web site.

·       DocumentThe attribute value is an attached document. The attribute value is in the format of a document management system and the document name. In the current release, only the PL/SQL document is supported. The PL/SQL document contains data inserted from a database.

·       RoleThe attribute value is a role.

·       AttributeThe attribute value is the value of another attribute’s value at runtime. This is called a reference attribute.
If you enter an optional default value for your attribute, Oracle Workflow Builder provides all of the necessary validation. For example, if you select Attribute as the attribute type, you can only select a defined attribute within the workflow process. If you select Lookup as the attribute type, you can only select a lookup code that is valid for the selected lookup type
Selecting the access level for attributes is the same as selecting the access level for item types. Create a new attribute with an internal name of NEW_FLAG and a display name of NEW Flag. Choose attribute type Lookup and lookup type Boolean. Choose True as the default value. You are not going to use this attribute in your workflow process, but you are going to build on it later. Click OK to save your work.


Figure 5: Attribute Properties form

Processes
Process is a workflow progression. Before you can diagram a workflow process, you must define a process activity. To do this, right-click on the Process icon and choose New Process. The Process Properties window appears. Enter, in uppercase and with no spaces, a unique internal name for your process. Also, enter a display name. The display name is the one that will appear in your process diagram. You have the option of entering a description. Select the result type for this process. Select None if no specified result codes are necessary for the completion of the process.

The result type must be a lookup type. Transitions in the workflow process diagram will differ depending on the result codes of the lookup type. If you have the authority, you can click on Edit to view or edit the result type. Check Runnable if this process can be called from other workflow processes or from Workflow Engine APIs. Create a process activity called NEW_PO_PROCESS

A display name of NEW PO Approval Process appears as an Approval result type. You have the option of checking the Runnable box. Last, select an icon to represent this process activity. Click on Browse to locate available icons (see Figure-6).


Figure 6: Process Activity Properties form

Select the Details tab, where you can select the error-handling process.
You can also specify the maximum time to wait for notification before a time-out occurs. Since this is a process activity and not a notification activity, the time-out parameters are not applicable. The effective date and version are for display only. If you save your workflow process using the Save As option, the effective date and the version number will be changed. Check Loop Reset to identify process activity behavior if a loop condition occurs. 

A loop condition occurs when the process activity is revisited by the Oracle Workflow Engine. If Loop Reset is checked, the process activity will be reexecuted and all of the subsequent processes will be reversed (see Figure -7). Click on OK to save your work.


Figure 7: Process Activity Properties (Details) form

The Roles and the Access tabs are the same as the item types and attributes. The next section will demonstrate how to diagram a workflow process.

Notifications
Notifications are messages sent to users. To set up a notification activity, you can either (1) drag and drop a defined message into the notifications arm of the same item type or (2) you can right-click on the Notification icon and select New Notification. As in a process activity, you must specify an internal name and a display name for a notification activity. Enter a unique name—in uppercase and without spaces—for your process. The display name is the one that will appear in your process diagram. Entering a description is optional. Select the result type for this process. You can select None if no specified result codes are necessary for the completion of the process. The result type must be a lookup type. Transitions in the workflow process diagram will differ depending on the result codes of the lookup type. Click on Edit to view or update the result type.

Since this is a notification activity, you must select a message. If you use the drag-and-drop message method, the message name will already be filled in. You can click on Edit to view or update the message. If the message you selected expects a response, a Function field will appear. This is the response function. Next, you can check Expand Roles if you want to expand the role to each individual user’s email instead of the role’s email. As a last step, you must select an icon to represent this notification activity. Click on Browse to locate available icons (see Figure-8).

Create a notification activity with the internal name of NEW_PO_APPROVE and a display name of NEW PO Approval by dragging and dropping the Approve PO message. You do not have the Approve PO message yet. You can drag and drop the Approve PO message from the PO Approval item type to your item type. Once you have entered all of the data, click on OK to save your work.


Figure 8: Notification Activity Properties form

Select the Details tab. In the Detail form, you may select the error-handling process. If you wish, you can also specify the allowable wait time for notifications before declaring a time-out. Since this is a notification activity, the time-out parameters are applicable. The effective date and version are display only. 

If you save your workflow process using the Save As option, the effective date and the version number will be changed. Check Loop Reset to identify the behavior you want the process activity to perform if a loop condition occurs. Loop conditions occur when the process activity is being revisited by the Oracle Workflow Engine. If Loop Reset is checked, the process activity will be reexecuted and all of the subsequent processes will be reversed. The Roles and the Access tabs correspond to the attributes and process activities item types.

Functions
Functions are PL/SQL stored procedures that can have Workflow Engine APIs. To create a new function, right-click on the Functions icon and select New Function. The Function Properties window will appear. Enter a unique internal name in uppercase letters. The name should not contain spaces. Then enter a display name for the function. The display name will appear in the process diagram. You may enter a description. Next, enter the name of the PL/SQL stored procedure in the format of package_name.procedure_name. Select the result type for this process.

You can select None if no specified result codes are necessary for the completion of the process. The result type must be a lookup type. Various transitions in the workflow process diagram are possible and will depend on different lookup type result codes. Click on Edit to view or update the result type. You can then specify the cost of the activity. Depending on this cost and the threshold of the Workflow Engine, this function activity may be deferred and ultimately processed by the background process. As a last step, you must select an icon to represent this function activity. You can also click on Browse to locate icons from your desktop (see Figure-9). You do not need to create a function activity for this exercise.


Figure 9: Function Activity Properties form

The Details tab, the Roles tab, and the Access tab are identical to the ones described in the previous sections.

Messages
Messages are templates used by a notification activity. If you want to create new messages, right-click on New Message. At this time, you need not create a new message. You have already created a message called Approve PO. Double-click on the Approve PO message to see its properties.

There is an internal name, a display name, and a description. The internal name must be unique and typed in all uppercase with no spaces. You may select a default priority for the message. Valid values are from 1 to 99, with 1 designated as highest priority. Priority selection is for informational purposes only; there is no functionality attached to the assigned priority (see Figure-10).

Figure 10: Message Properties form

Select the Body tab to enter the subject of the message and the body. You can assign message attributes to the subject and body by adding an ampersand sign before the attributes’ internal names (see Figure-11). The Roles tab and the Access tab are the same as described in the previous sections.

Figure 11: Message Properties (Body) form

Notice the plus sign (+) next to the Approve PO message in the Navigator. This indicates that the Approve PO message has message attributes. Click on the plus sign next to Approve PO to see all of the message attributes associated with the Approve PO message. A message attribute may have Send or Respond options. Send attributes are regular attributes.

Respond attributes are message attributes that solicit responses in the notification message. Display names of the respond attributes become prompts in the response section of the notification message. Descriptions of the respond attributes are used to describe the expected response. If the respond attribute is a lookup type, the user can respond by selecting from a list of lookup codes. You can specify message attributes to get their values from the item attributes. This is indicated by selecting Item Attribute as the default value for the message attribute and selecting the associated item attribute. To create a new message attribute, right-click on 

Attribute
You must enter a unique internal name typed in all uppercase and without spaces. Next, enter a display name. A description name is optional. Then, select the attribute type. The attribute type of the message attribute is the same as that of the item attribute. Next, specify whether the source is Send or Respond. As a last step, enter a default value, if applicable. You can get the default value from an item attribute. (See Figure-12 for the properties of the Approval Action message attribute of the Approve PO message.)


Figure 12: Message Attribute Properties form

Lookup Types
The last components are the lookup types. Lookup types are lists of lookup codes defined for use by activities. For example, you can find the Approval lookup type in the Standard item type. If you want to create a new lookup type, right-click on the Lookup Types icon and choose New Lookup Type. Double-click to see the properties of the Approval lookup type. You will see the internal name, the display name, and a description for the lookup type.
The Access tab is the same as described previously (see Figure-13). To add a new lookup code, right-click on the Lookup Types icon and choose New Lookup Code. A Lookup Code Properties window appears. Type the internal name and the display name for the lookup code. You can also add an optional description (see Figure-14). Once you have defined a lookup code, it will show up as a separate icon under the Lookup Types icon.


Figure 13: Lookup Types Properties form


Figure 14: Lookup Code Properties form

1.      How many types of activities are available?
2.      What is a prerequisite for creating a notification activity?
3.      When will the time-out parameters apply?
4.      How can you find the lookup codes for a specific lookup type?