Human Interaction Event Service

The Human Interaction Event service flags business processes that require human action and creates references to the business process data to await human action.

The Human Interaction Event service:
  • Is the service that starts human interaction at one or more steps in the business process.
  • Handles the updating and deletion of mined data, which is data that is pulled from the business process and written to the Sterling B2B Integrator internal database for future use through demining. Demining is the action of retrieving data from the internal database for display in a Web browser.
  • Is used at any point in a business process where human interaction is needed.

The following table provides an overview of the Human Interaction Event service:

System name HumanInteractionEvent
Graphical Process Modeler (GPM) categories All Services, Web Extensions
Description The Human Interaction Event service:
  • Adds documents requiring Human Interaction to the WEBX_MINED_DATA table in the Sterling B2B Integrator database. In addition to adding the document, reference data about the document and the current state of the business process used to invoke the Human Interaction Event service is added to the database.
  • Updates documents, along with the document reference data in the database.
  • Deletes documents from the database, along with the document reference data.
This service can also suspend a business process until certain actions take place (such as approval of a document) and then resume processing.
Business usage A business process uses the Human Interaction Event service to save documents requiring approval in the database and then send out an email notification to the approver. Another business process might include the following services and adapters to work with the documents saved in the database:
  • Human Interaction Query service to retrieve all documents requiring approval from the database
  • Human Interaction XForms service and B2B HTTP Server adapter to display the results from the Human Interaction Query service to the Web browser for user selection
Note: Because of our continuing efforts to improve services and adapters to align with new technology and capabilities, the B2B HTTP Server adapter has entered the retirement process in Sterling B2B Integrator and will be replaced with the HTTP Server adapter. See Retiring and Removed Services and Adapters.
  • Human Interaction Document Loader service to retrieve the selected document from the database and pass the document to the Human Interaction XForms service for displaying in the Web browser for approval
Usage example An organization may want to monitor all purchase orders, requiring approval for any PO request that exceeds $1000.00. The business process associated with the submission of a PO could be configured to send the PO request to the employee's manager, suspending the business process until the approval is complete. After the PO is approved or rejected, the business process completes the steps to either submit the PO or send a rejection back to the employee.
Preconfigured? No
Requires third-party files? No
Platform availability All supported Sterling B2B Integrator platforms
Related services Designed to work with:
  • Human Interaction Query service
  • Human Interaction Document Loader service
  • Human Interaction XForms service
Application requirements None
Initiates business processes? The user can specify the WebSuiteEmailNotif business process on the Human Interaction Event service NotificationBPName parameter to invoke this business process for generating an email notification. The WebSuiteEmailNotif business process comes predefined with Sterling B2B Integrator. The user can also create a customized business process that sends email notifications in a specific format and invokes the business process using the NotificationBPName parameter.
Invocation Runs as part of a business process.
Business process context considerations None
Returned status values Returned status values:
  • WorkFlowContext.SUCCESS: Success, with no errors.
  • WorkFlowContext.ERROR IllegalArgumentException: Caught IllegalArgumentException in EventService.processData()
  • WorkFlowContext.ERROR IllegalStateException: Caught IllegalStateException in EventService.processData()
  • WorkFlowContext.ERROR SQLException: Caught SQLException in EventService.processData()
Restrictions None
Testing considerations None

How the Human Interaction Event Service Works

Use the Human Interaction Event service to save business process data requiring human interaction in the Sterling B2B Integrator database. The following sections describe a business scenario and a sample solution for using the Human Interaction Event service.

Business Scenario

Your company receives a purchase order in XML format from a trading partner. The purchase order needs to be approved prior to further processing.

The approach used to solve this business scenario includes the creation of a business process that does the following:
  • Accepts the purchase order as input.
  • Includes a Human Interaction Event service that saves a reference to the purchase order, the reference data about the purchase order, and the current state of the business process data in the Sterling B2B Integrator database and marks the business process as requiring human interaction. The reference data for this example includes the following information:
    • The document type (purchase order)
    • The Sterling B2B Integrator user account of the person sending the purchase order
    • The Sterling B2B Integrator user account of the person who is to receive the purchase order (approver)
    • The state of the purchase order (Awaiting Approval)
    • The status of the purchase order (Unread)
    • The Web template used to display the purchase order in the Web browser

The Human Interaction Event service is also configured to invoke the WebSuiteEmailNotif business process for sending an email notification to the approver. The email notification includes the URL used to display the purchase order requiring approval in the Web browser.

Note: You must have a valid, checked-in Web template to display an item requiring human interaction in the Web browser.

This business solution example focuses only on the Human Interaction Event service functionality.

GPM Example

The following example shows a solution to the business scenario using the GPM. The purchase order is input to the business process and becomes the primary document.

(Screen 1 of 2)

Human Interaction Event (Screen 1)

(Screen 2 of 2)

Human Interaction Event (Screen 2)

The Assign statement is used to assign the purchase order number from the primary document to process data. The Human Interaction Event service uses the purchase order number in process data to set its ReferenceId parameter.

After the Human Interaction Event service completes, a row is added to the Sterling B2B Integrator WEBX_MINED_DATA database table containing the reference data about the purchase order and a reference to the actual purchase order document. In addition, an email notification is sent to the approver that includes the URL for displaying the actual purchase order. For example:

E-Mail Notification
Note: The Web template specified in the URL should be designed to invoke a business process that uses the Human Interaction Document Loader service to load the purchase order (identified by its documentId in the URL) from the Sterling B2B Integrator database prior to displaying the Web page.

The approver specifies the URL in the Web browser to display the purchase order requiring approval. The approver could alternatively log into the Sterling B2B Integrator Web Suite application to view (in their inbox) a list of documents requiring approval.

Business Process Modeling Language (BPML) Example

The following example shows the corresponding business process solution using BPML:

<process name="ExamplePurchaseOrderHIEventWithMail"> 
<sequence name="Start HI Event Service"> 
<assign name="Assign" to="poNumber" from="DocToDOM(PrimaryDocument)/
     @Id" append="true"/> 
<operation name="Human Interaction Event"> 
<participant name="HumanInteractionEvent"/> 
<output message="HumanInteractionEventTypeInputMessage"> 
	<assign to="DocumentType">Purchase Order</assign> 
	<assign to="FromAccount">SenderSterlingIntegratorUserAccount</assign> 
	<assign to="NotificationBPName">WebSuiteEmailNotif</assign> 
	<assign to="Operation">ADD</assign> 
	<assign  to="ReferenceId" from="number(/ProcessData/poNumber/@Id)"/> 
	<assign to="Status">Awaiting Approval</assign> 
	<assign to="StorageArea">Inbox</assign> 
	<assign to="SuspendAsWaiting">NO</assign> 
	<assign to="SystemAccount">ReceiverSterlingIntegratorUserAccount</assign> 
	<assign to="TemplateName">ExamplePurchaseOrderFromHTTPRequest</assign> 
	<assign to="." from="*"/> 
</output> 
<input message="inmsg"> 
	<assign to="." from="*"/> 
</input> 
</operation> 
</sequence> 
</process> 

See Usage Examples for additional examples using the Human Interaction Event service.

Implementing the Human Interaction Event Service

To implement the Human Interaction Event service, complete the following tasks:
  1. Activate your license for the Human Interaction Event service. See Installing Sterling B2B Integrator.
  2. Create a Human Interaction Event service configuration. See Managing Services and Adapters.
  3. Use the Human Interaction Event service in a business process.

Human Interaction Event Service Business Process Usage

The following screen shows the graphical view of the GPM parameters for the Human Interaction Event service. There are no fields to be configured on the Message From Service tab.

Human Interaction Event Service BP Usage

The following example shows the corresponding BPML parameters for the Human Interaction Event service GPM parameters.

<process name="ExampleHIEventGPMParams"> 
<sequence name="Start HI Event Service"> 
<operation name="Human Interaction Event"> 
<participant name="HumanInteractionEvent"/> 
<output message="HumanInteractionEventTypeInputMessage"> 
	<assign to="ArchiveFlag">1</assign> 
	<assign to="ArchiveHours">24</assign> 
	<assign to="DocumentType">Purchase Order</assign> 
	<assign to="FromAccount">SendingTradingPartnerSystemAccountID</assign> 
	<assign to="GroupName">SendingTradingPartnerSecurityPermissionGroup</assign> 
	<assign to="IdentityName">SendingTradingPartnerName</assign> 
	<assign to="MergeDataOnResume">NO</assign> 
	<assign to="MergeDataOnUpdate">NO</assign> 
	<assign to="NotificationBPName">UserDefinedBPForSendingEmailNotifications</assign> 
	<assign to="Operation">ADD</assign> 
	<assign to="ParentAccount">ManagerOfTheDocumentSender</assign> 
	<assign to="ReferenceId" from="number(/ProcessData/poNumber/@Id)"/> 
	<assign to="State">PendingApproval</assign> 
	<assign to="Status">Unread</assign> 
	<assign to="StorageArea">Inbox</assign> 
	<assign to="SuspendAsWaiting">NO</assign> 
	<assign to="SystemAccount">ReceiverCompanyUserAccount</assign> 
	<assign to="TemplateName">ExamplePurchaseOrders</assign> 
	<assign to="Timeout"/> 
	<assign to="." from="*"/> 
</output> 
<input message="inmsg"> 
	<assign to="." from="*"/> 
</input> 
</operation> 
</sequence> 
</process>

The following table describes the fields used to configure the Human Interaction Event service in the GPM:

Field Description
Config Name of the service configuration.
ArchiveHours The number of hours the mined data record should remain in the Web Extension table before it is archived or purged. Valid value is a positive integer. Optional. If blank, the time span from the business process is used, if it has been specified. If the time span from the business process has not been specified, the system default is used.
ArchiveFlag The archive method that should be used. Optional. Valid values:
  • Archive – Archives the data in the Web Extension table.
  • Purge – Deletes the data from the Web Extension table.
If left blank, the archive method from the business process is used.
DocumentType Type of data that requires human interaction. Valid value is any alphanumeric string. Examples include Purchase Order, Invoice, and Remittance Advice.
Note: The value specified for this parameter is the name of the document that appears under Document Type in the user's inbox when using the Sterling B2B Integrator Web Suite to display documents.
FromAccount Trading partner system user account ID (as defined in Sterling B2B Integrator) of the trading partner who sent the document. This account is also associated with the trading partner's trading profile.
GroupName Name of the security permission group to which the trading partner who sent the document belongs.
IdentityName Name of the trading partner who sent the document. This name is associated with the FromAccount information listed in this service. This parameter allows for searching records pertaining to a specific company.
MergeDataOnResume Merges any changes made to the Web template with the existing instance data when the business process is taken out of the waiting state. Valid values:
  • YES – Causes the documents and instance data to be merged when the business process is resumed.
  • NO – Overlays the business process being resumed (taken out of a waiting state) with the changed documents and instance data. Default.
MergeDataOnUpdate Merges any changes made to the Web template with the existing instance data. Valid values:
  • YES – Default.
  • NO – Update only the status or state of an item and not the document contents.
The parameter affects processing only when the Operation parameter is set to UPDATE.
NotificationBPName Business process (for example, the WebSuiteEmailNotif business process) runs by the Human Interaction Event service with the purpose of generating an email notification to the individual who receives the document. The WebSuiteEmailNotif generates an email notification based on the email address associated with the Sterling B2B Integrator user account (SystemAccount) set-up for the trading partner receiving the document and the user account (FromAccount) set-up for the trading partner who sent the document. The WebSuiteEmailNotif business process comes predefined with Sterling B2B Integrator. Alternatively, you can create and specify a customized business process that sends email notifications in a specific format. If you choose this method, you should model the WebSuiteEmailNotif business process. Valid values are any checked-in business process from the list that is designed to generate email notifications. The default value is Not Applicable.
Note: If you are using a business process that looks up the email addresses from the user accounts specified with the SystemAccount and FromAccount parameters and if the Sterling B2B Integrator user account does not contain a valid email address, the associated SMTP Send adapter fails and the email notification is not sent.
Operation The requested action for the document. Required. Valid values:
  • ADD – Add a new document along with its reference data.
  • DELETE – Delete an existing document along with its reference data.
  • UPDATE – Update an existing document along with its reference data.
Note: You must specify the MinedDataId parameter as an input parameter to the Human Interaction Event service for the DELETE and UPDATE operations. Use the Advanced Editor or BPML to specify the MinedDataId parameter. See Updating or Deleting a Document in the Application Database for more information about the MinedDataId and examples for specifying the parameter.
ParentAccount Account name for the manager of the From Account—the document sender. This user account name is associated with the FromAccount information in this service.
ReferenceID Document identifier. Valid value is any alphanumeric string, such as a purchase order number or an invoice number.
Note: The value specified for this parameter is displayed as the Identifier in the user's inbox when using the Sterling B2B Integrator Web Suite to display documents.
State Document process stage. Valid value is any alphanumeric string, such as Approved, Pending, or Rejected. If no state is entered, the default is Active.
Status Status of the document. Valid value is any alphanumeric string, such as Read or Unread.
Note: The value specified for this parameter is displayed as the Status in the user's inbox when using the Sterling B2B Integrator Web Suite to display documents.
StorageArea Virtual location to store the data waiting for the person to take action on it. Valid value is any alphanumeric string, such as Inbox, Outbox, and Drafts.
Note: The value specified for this parameter corresponds to a folder name used to display documents from this storage area in the Sterling B2B Integrator Web Suite.
SuspendAsWaiting Setting for specifying whether to place the business process into a waiting status until human interaction is complete. Required if Operation field is set to ADD or UPDATE. Valid values:
  • Yes – Business process is placed in a wait state. The business process continues waiting until an action is taken on the document (such as updating by another instance of the Human Interaction Event service) or until the value specified with the Timeout parameter expires. See Placing a Business Process in a Waiting State for Human Interaction for an example.
  • No – Business process continues processing and the document becomes available for viewing.
SystemAccount Trading partner user account ID (as defined in Sterling B2B Integrator) of the person who must interact with the business process.
Note: The document is stored in this user's storage area (such as the inbox) in the Sterling B2B Integrator Web Suite.
TemplateName Name of the Web template to use for viewing the data. Select the Web template name from the list of deployed Web templates. Required if you are using the Sterling B2B Integrator Web Suites to view documents.
Note: If you are using a custom Web application for viewing data in the Sterling B2B Integrator database, you can either specify the Web template with the Human Interaction Event service or with the Human Interaction XForms service.
Timeout Amount of time, in minutes, before the waiting status expires, causing the business process to fail with an advanced status of Human Interaction Timeout Event. Timeout is recognized only if the SuspendAsWaiting field is set to YES.
Note: The Timeout parameter also is dependent on the BPExpirator. The BPExpirator schedule looks for expired business processes based on the time set in the scheduler and resumes the business process with an advanced status. The default schedule time is 15 minutes.

Usage Examples

The following sections contain additional examples for using the Human Interaction Event service.

Placing a Business Process in a Waiting State for Human Interaction

The example in this section describes a scenario that uses the Human Interaction Event service to save a reference to the business process data in the database and place the business process in a wait state until the purchase order is approved. The Human Interaction Event service is also configured to invoke the WebSuiteEmailNotif to send an email notification to the approver. After the purchase order is approved, the business process resumes and continues with the next step. In this scenario, the next step is to invoke a subprocess for further processing of the purchase order.

The following example illustrates this scenario using the GPM.

Waiting State (Screen 1)

Screen 1 of 2

Waiting State (Screen 2)

(Screen 2 of 2)

The Assign statement is used to assign the purchase order number from the primary document to process data. The Human Interaction Event service uses the purchase order number in process data to set its ReferenceId parameter. After the document is added to the database, you can use the following services to complete the approval process:
  • Human Interaction Query service to retrieve a list of purchase order references awaiting approval
  • Human Interaction Document Loader service to retrieve the actual purchase order associated with the reference returned from the Human Interaction Query service
  • Human Interaction XForms service to display the purchase order in the browser for necessary updates and approval
  • Human Interaction Event service to update the database with the changes made to the purchase order and to change the status of the purchase order to Approved. After updating the purchase order, the originating business process resumes processing and starts the subprocess. See Updating or Deleting a Document in the Application Database for more information.

The following example illustrates the business process using BPML:

<process name="ExamplePurchaseOrderHIEventWaiting"> 
<sequence name="Start HI Event Service"> 
<assign to="poNumber" from="DocToDOM(PrimaryDocument)/@Id" append="true"/> 
<operation name="Human Interaction Event"> 
<participant name="HumanInteractionEvent"/> 
<output message="HumanInteractionEventTypeInputMessage"> 
	<assign to="DocumentType">Purchase Order</assign> 
	<assign to="FromAccount">SendingTradingPartner</assign> 
	<assign to="MergeDataOnResume">NO</assign> 
	<assign to="MergeDataOnUpdate">NO</assign> 
	<assign to="NotificationBPName">WebSuiteEmailNotif</assign> 
	<assign to="Operation">ADD</assign> 
	<assign to="ReferenceId" from="number(/ProcessData/poNumber/@Id)"/> 
	<assign to="State">PendingApproval</assign> 
	<assign to="Status">Unread</assign> 
	<assign to="StorageArea">Inbox</assign> 
	<assign to="SuspendAsWaiting">YES</assign> 
	<assign to="SystemAccount">ApproverAccount</assign> 
	<assign to="TemplateName">ExamplePurchaseOrders</assign> 
	<assign to="Timeout">60</assign> 
	<assign to="." from="*"/> 
</output> 
<input message="inmsg"> 
	<assign to="." from="*"/> 
</input> 
</operation> 
<operation name="Invoke Sub-Process"> 
<participant name="InvokeSubProcessService"/> 
<output message="InvokeSubProcessServiceTypeInputMessage"> 
	<assign to="INVOKE_MODE">ASYNC</assign> 
	<assign to="WFD_NAME">ExampleHIEventSubProcess</assign> 
	<assign to="." from="*"/> 
</output> 
<input message="inmsg"> 
	<assign to="." from="*"/> 
</input> 
</operation> 
</sequence> 
</process> 
For more information, see:
  • Human Interaction Query Service for a business scenario describing how to use this service to retrieve the purchase order reference data from the Sterling B2B Integrator database.
  • Human Interaction Document Loader Service for a business scenario describing how to use this service to retrieve the actual purchase order from the Sterling B2B Integrator database.
  • Human Interaction XForms Service for a business scenario describing how to use this service to display a list of documents.

Updating or Deleting a Document in the Sterling B2B Integrator Database

You must specify the MinedDataId parameter as an input parameter to the Human Interaction Event service when updating or deleting a document in the database. The MinedDataId parameter corresponds to the value in the MINED_DATA_ID column of the WEBX_MINED_DATA table. This value is populated when a document is added to the database using the Human Interaction Event service.

Use the Human Interaction Query service to retrieve the reference data for documents. The reference data includes the MinedDataId for each document. The MinedDataId corresponds to the listItem objectId attribute returned by the Human Interaction Query service.

You can specify these fields by using the Advanced Editor option in the GPM Service Editor or by using BPML.

The following example illustrates specifying the MinedDataId parameter in the GPM. This example assumes that the MinedDataId value was loaded into process data (not shown).

Advanced Editor

The following example illustrates the same business process by using BPML. This example assumes that the MinedDataId value was loaded into process data (not shown).

BP Using BPML
Note: If the business process used to add the document to the database is in a wait state, an update or delete causes the business process to resume processing.