Skip to main content

PBP


Overview

A Packaged Business Process, or PBP for short, is a special type of workflow that can be used to configure a sequence of actions with nodes, and can also be called by other workflows with defined input parameters. The execution results in a packaged business process can also be used by external workflows through output parameters.

At the same time, the packaged business process also automatically generates a set of API, which correspond to the defined input and output parameters for external systems. With worksheets and workflows, together with the APIs of packaged business processes, in fact, the enterprise has a flexible API center, realizing a composable architect.

The concept of Packaged Business Process (PBP) comes from the Packaged Business Capabilities (PBC) framework proposed by Gartner. Unlike the classic PBC concept, a composable application architecture such as PBP does not rely on the native development process of separation of front and backend plus microservices, which can be realized with no code.

Features and Values

  1. There is no specific data source, and it is triggered by defined input parameters.

  2. It can be called by all workflows in the organization.

  3. It is equipped with API capability for external systems, enabling free-combination of business processes.

Use Cases

1. Reusable general business processing capability

Scenario 1: Update inventory

Inventory update involves a variety of scenarios, such as sales, out-of-warehouse, purchases, returns, in-warehouse, etc. When updating inventory, you need to know the warehouse, the product, out-of-warehouse or in-warehouse, and the quantity. Therefore, you can configure a packaged business process to do this, passing in the corresponding parameters through the workflows of sales and out-of-warehouse, purchase and in-warehouse, you can complete the inventory update, without having to write the logic of updating inventory again for each workflow.

Scenario 2: Get the place to which a phone number belongs

Some worksheets record cell phone numbers, such as Contacts, Employee Management worksheets, etc., and you need to know where the cell phone number belongs to. You can call a third-party service through a Webhook node to get the cell phone number and return the place. A general data processing capability like this, realized through a Webhook or a code block, is ideally set as a packaged business process to be called by all workflows.

2. API services for multiple business objects

Scenario: Query data of multiple worksheets through API for external system

For example, the external system needs to query the order data, including:

  • Data in the Order worksheet (order name, amount, payment date)
  • Data in the Order Detail worksheet (product name, quantity, unit price, subtotal)

If you query the data through the worksheet API, you need to call the API twice, and there are more result fields returned, so it is not possible to return only the required fields. At the same time, the reminder of the query status cannot be customized.

If you choose the API of packaged business process, you only need to pass in the order number, and after triggering the process, it will query the order and detail data through the query data node step by step, and customize the query status with branches according to the different query results, and finally return it through the output parameter.

3. Standardized and normalized business processes

Scenario 1: Unified management of payment process

If the enterprise requires unified and standardized management of payment process, then it is very suitable for managing payment process through PBP. For example, after the payment application or reimbursement application is approved, it enters the payment process (PBP), and after the payment is completed and the payment voucher is uploaded, it is then written back to the payment application.

Scenario 2: Joining process for new employees

According to the employee's department and position, it automatically sends him/her a list of employee manuals and items to be claimed, and based on the mailbox or cell phone number, the operation and maintenance staff opens software accounts for him/her, etc. After this, send the results to the employee. Set the above as a packaged business process, and it can help to standardize the joining process.

4. Workflow triggered by one click or code scanning on the application homepage

Scenario: After the equipment is repaired, the maintenance personnel can click the button in the custom page to start the code scanning, scanning the equipment code and triggering the PBP, which will query the related equipment and the maintenance work order according to the passed-in equipment code, and then modify it to the normal status respectively.

Configuration Examples

Learn more details about PBP with a few examples below:

1.1 Four elements of PBP

Before setting the process, we need to sort out the four elements needed for PBP.

  • Input Parameters

    When updating inventory, you need to know the updated object and quantity, as well as in-warehouse or out-of-warehouse. So it needs the product ID, whether to increase or reduce the inventory, and the quantity, and these three pieces of information are the parameters that are needed.

    The input parameters to be defined are: Product ID , Out-of-warehouse/In-warehouse and Quantity.

    If the product is of multi-warehouse management, you will also need to figure out which warehouse it is, and you will also need an input parameter, warehouse information. This parameter will not be added for a quick example here.

  • Workflow Configuration

    When the workflow is triggered, update the inventory of the specified product through the relevant nodes and actions.

  • Output Parameters

    When updating inventory, there is no need for any result to be returned, so you do not need to define output parameters.

  • Whether to enable API capability

    There is no need to enable the API capability as it is only available within HAP platform.

1.2 Create a PBP

Go to the workflow module of the application and click [PBP] > [Create New PBP].

While PBPs can be called by workflows in all applications in the organization, they are still managed in one application.

1.3 Define input parameters

What is a parameter? Simply put, it's information that you need to have passed to you from the outside, but that you need to constrain in advance.

For example, the name and format, the name is used to distinguish between different information objects, and the format is used to ensure that the content passed in conforms to the specification.

If some information is necessary when processing, it can be set to required.

At the same time, it is recommended to fully edit the parameter description, so that it is clear when the other party calls PBP to pass in the parameter.

In this example, the parameters to be defined (name, format, required or not, and description) are as follows:

  • Product ID, text, required, description

  • Out-of-warehouse/In-warehouse, number, required, description (0 for in-warehouse, 1 for out-of-warehouse)

  • Quantity, number, required

In the trigger history of a process, the triggered data is shown as a header parameter.

Input parameter types that are supported

  • Text
  • Number
  • Members
  • O-roles
  • Department
    • Where for members and departments, it is the object, not the text that is passed.
  • Date/Time
  • File
  • Normal arrays and object arrays
    • For arrays output by code blocks, they need to be parsed by JSON before they can be selected as input parameters.

Demonstration of Array Structure

  • Normal arrays

    ["A","B"]

  • Object arrays

    [{"name":"A","age":20},{"name":"B","age":30}]

    If you have a JSON array, you can paste it to generate parameters.

1.4 Configure nodes in the workflow

The logic for inventory updates is implemented through the configuration of the relevant nodes.

Highlights: how to use input parameter values in nodes

When locating a product's inventory record, you need to use the product ID that was passed in, by selecting the input parameter for the conditional value in the [Get Single Data] node.

1.5 Configure output parameters

We have already sorted it out before, there is no need for output parameters. Click the [Output Parameters] node and then delete the blank parameters and save the node.

1.6 Modify workflow name and publish it

  • Modify the workflow name for ease of management and for easy calling by external processes.

  • The workflow can be called only after it is published.

How to call PBP by other pworkflows

After PBP is published, other workflows that involve inventory updating can call the PBP. Here is an example of how to call PBP in the purchase workflow.

In the purchase workflow, you can call the "Update Inventory" PBP when you get multiple in-warehouse records ([Get Multiple Data] node).

1) Add the [Call PBP] node

2) Select the [Update Inventory] PBP

3) Execution method (Perform once/Perform multiple times)

This is similar here as in the subflow node. In this example, it is necessary to update the inventory with multiple in-warehouse records, so here select [Perform multiple times]. At the same time, the execution times should be Based on the amount of data in multiple data objects.

Since the inventory update for each item does not affect each other, parallel execution can be selected.

How many rows of data can be received when PBP is executed multiple times

There are different limits on the execution times for different configurations. The two main ones are as follows.

  • If [Based on field value] is selected, it is executed as many times as it actually is, with no limit.

  • If [Based on the amount of data in multiple data objects] is selected

    • If any of the passing parameters of the PBP uses field values from multiple records, then it is up to 100 rows.

    • If none of the passing parameters of the PBP use field values from multiple records, it is up to 10,000 rows.

4) Set the passing parameters

The parameters shown here are the input parameters defined in the PBP.

The product ID and in-warehouse quantity are the corresponding fields selected from the node object.

Because it is an in-warehouse process, the type (in-warehoue/out-of-warehouse) can be written as a fixed value of 0. In the out-of-warehouse process, it is written as 1.

5) Publish and test

6) Enable API capability

There is no need to enable API capability in this process.

Enable API:

Example 2. Get the place to which a phone number belongs through PBP

2.1 Four elements of PBP

  • Input Parameter: The phone number.

  • Workflow Configuration: After getting the phone number, add the [Send API Request] node for external service's API to get the place to which the phone number belongs.

  • Output Parameter: Output the information obtained (province, city and county).

  • Enable API capability: There is no need to enable the API capability as it is only available within HAP platform.

2.2 Create a PBP

Go to the application's workflow module and click [PBP] > [Create New PBP].

2.3 Configure input parameters

Simply define a parameter for the phone number.

2.4 Set nodes in the workflow

In this example, you only need to add the [Send API Request] node to get the place to which the phone number belongs.

2.5 Configure output parameters

Depending on your needs, you can concatenate the province and city as one parameter to output, or directly write them into the Region/City field in the worksheet.

Note the / between province and city, or it won't be written into the Region/City field.

2.6 Modify the workflow name and publish it

PBP called by other workflows

For example, in a workflow triggered when a lead contact is added, the PBP is called to get the place to which the phone number belongs.

  • Execution method: Since it is to query the place to which the newly added contact's phone number belongs, it is executed once.

  • After the business process is executed, start the next node

    If subsequent nodes need to use the PBP's output parameters, check it.

  • Input parameters: Simply select the phone in the triggering node.

How subsequent nodes use PBP parameters

If you are unable to select PBP's output parameters, it means you did not check [After the business process is completed, move on to the next node].

Publish the workflow and test.

Example 3. Query orders through PBP for external systems

External systems can query customer company, order amount, payment date, and order details (product name, price, quantity, subtotal) based on the order number.

3.1 Four elements of PBP

  • Input Parameters

    • Only one parameter required: Order No. (text, required).
  • Workflow Configuration

    After triggering the workflow, update the inventory of specified products through nodes and actions.

    • [Get Single Data] node: Get the corresponding order based on the order number.

    • [Get Multiple Data] node: Get order details based on the order record.

    • [Code Block] node: Convert order details into an array.

  • Output Parameters

    • Customer company (text)
    • Order amount (numeric)
    • Payment date (text)
    • Order details (array)
  • Enable API Capability

    This PBP is for external systems, therefore, API capability needs to be enabled.

3.2 Create a PBP

Go to the application's workflow module and click [PBP] > [Create New PBP].

3.3 Configure input parameters

Just define an order number parameter.

3.4 Set nodes in the workflow

Node configuration is as follows:

How to convert multiple rows of data to an array

3.5 Configure output parameters

Define four output parameters.

3.6 Modify workflow name and publish it

3.7 Enable API capability

Go to [Configuration] > [API Capability] to enable or disable it.

1) Request Address

An API address will be automatically generated for the workflow, e.g., https://api.mingdao.com/workflow/hooks/******2YzQzNDVlZDM0YzBhNDRiMWU0.

You can splice sub-paths in the request address, for example, the interface is used to get order information, you can splice GetOrderinfo, easy for the developer to identify, but in the actual implementation,it is still only the previous auto-generated part of the valid.

2) Authentication

If you choose [Use Application Authorization], two parameters, appKey and sign, are required when calling the API; if you choose [No Authorization Required], these two parameters are not required.

3) Define Request Parameters in API (Input Parameters)

Parameter names in PBP can be in Chinese for internal use, but aliases need to be defined for use in the API for external systems.

  • If there is an alias, the parameter name in the API parameter is displayed as an alias.
  • If there is no alias, it is displayed as the parameter name, if it contains Chinese, there may be an error in use.

4) Response Method

It supports the following 5 response methods.

If it needs to return parameters to the request address, there can not be nodes in the PBP such as [Call PBP], [Approval], [Fill in], [Delay], [Subflow] and other nodes that are uncertain of the processing time.

5) Configure Response Parameters

Similar to setting request parameters, it supports setting English names and example values.

6) View API Documentation

Explore and test all available APIs in the application, including API for PBP.

Example code provided can be used directly for testing.

No need to modify appkey and sign when using the code.

Example 4. Manage payment process through PBP

If standard management of the payment process is required, for example, after a payment request or reimbursement request is approved, it goes to the payment PBP, upload the payment voucher and then written back to the record of payment request.

4.1 Four elements of PBP

  • Input Parameters

    The following information is required for payment: customer/individual name, account information, payment date, amount, and for viewing the original record, the URL of the original record is also needed. For the sake of simplicity, only the following fields are required.

    • Payment Title: Text, required

    • Account Info: Text, required

    • Amount: Numeric, required

    • Payment Date: Text, required

    • URL of the Original Record: Text, required

      Additionally, create a Payment worksheet to store these information and write the uploaded payment voucher to this worksheet. In addition to the above parameters, an "File" field for the payment voucher is needed.

  • Workflow Configuration

    • Add a record to the Payment worksheet based on the input parameters provided.

    • Add a [Fill in] node to notify the finance personnel to complete the payment and upload the voucher.

  • Output Parameters

    Since information such as the payment voucher is needed, but the return parameters do not support file fields, a record ID needs to be returned for the original business workflow to locate this payment record and use the voucher field.

    Record ID: Select the record ID of the payment record.

  • Enable API Capability

    No need to enable.

4.2 Create a PBP

Go to the application's workflow module and click [PBP] > [Create New PBP].

4.3 Set input parameters

4.4 Configure the workflow

  • Add a new record to the Payment worksheet.
  • Add a [Fill in] node to notify finance personnel.

4.5 Set output parameters

Output the record ID of the payment record.

4.6 Modify the workflow name and publish it

A workflow can only be called by the external after it has been published.

How to Call PBP in workflows and use output parameters

Taking the workflow of a payment request as an example, when the payment request is approved, call PBP and automatically write the voucher information into the request record after finance personnel's operation.

1) Add a [Call PBP] node

Select the PBP and choose the corresponding fields for parameters.

How to get URL of a record

2) Add a [Get Single Data] node to locate the payment record filled in by finance personnel

If unable to select PBP output parameters, check [Wait for the business process to finish before starting the next node].

3) Write the voucher info to the payment request record

Configuration complete, and you can submit a payment request for testing.

Example 5: Complete maintenance work orders by scanning device codes in custom pages

5.1 Four elements of PBP

Input Parameters: Devide code, text, required. Used to identify device records.

Workflow Configuration: Locate device records and maintenance work orders by device code, and change status to Normal or Completed.

Output Parameters: No need to return any information.

Enable AP Capability: Not required.

5.2 Create a PBP

Go to the application's workflow module and click [PBP] > [Create New PBP].

5.3 Set input parameters

Set one parameter for the device code.

5.4 Configure the workflow

Based on business requirements, add two [Get Single Data] nodes to get device records and maintenance records, then add two [Update Record] nodes to update the status.

5.5 Set output parameters

No output parameters needed, delete existing parameters and save.

5.6 Modify the workflow name and publish it

The workflow needs to be published before it can be called.

How to call PBP with a button in a custom page

Go to the configuration page of the custom page to set the button.

  1. Select the button and begin configuring related actions.

  2. Click the button to start code scanning.

    • It can also directly trigger the PBP, but in this example it needs to start scanning before calling the PBP.

  3. Choose the type of code.

    • Use QR code as an example here.
  4. Record Link

    • If the QR code is a record link, select "Null".
  5. Other Links

    • If the QR code is other link, select "Null".
  6. Text

    • The device code is a string of text, select to recognize the device code and then call the PBP.
  7. Select the PBP.

  8. Select the value of the input parameter, which is the scan result.

Save the configuration and click the button to test.


Have questions about this article? Send us feedback