跳到主要内容

3.7.4-business-methods

3.7.4 Business Methods

Business Methods allow for the definition of reusable functions that can be integrated into different stages of a process. Currently, Business Methods support six types of operations:

  • Message Notification
  • Add Data
  • Update Data
  • Delete Data
  • Variable Assignment
  • More (includes calling integration methods or business triggers from the low-code platform)

3.7.4.1 Use Cases

  • Contract Stamping Request: After an approval is granted, automatically notify both parties of the contract via email or SMS that the contract stamping application has been completed.
  • Task Management: Upon confirmation and approval of task completion, update the task status within the form.
Portal Diagram

Figure 3.7–16 Create New Business Method

3.7.4.2 Scenario Description

Scenario Description:
In a task management scenario, after a task completion is confirmed and approved, the system automatically updates the task status within the form.

Configuration Steps:

  1. Design the Task Tracking Form:
    Ensure that the form page for task tracking is properly designed.

  2. Add a New Business Method:

    • Enter the Business Method Name (e.g., "Update Task Status After Approval").
    • Select the Action Type as "Update Data". The system supports six different types; choose based on your business scenario.
    • Select the Target Form as "Designed Forms".
    • For the "If Instance Not Exists" option, choose "Ignore" (if the instance already exists, the update operation will not be performed).
    • Click on the “Method Settings” to open a pop-up window.
  3. Method Settings:

    • Select "Object Assignment" in the “Value Setting” dropdown.
    • Assign the "Task Status" field a "Fixed Value" (e.g., "Completed").
  4. Associate Business Method via Listener:

    • Select the relevant node in your process flow.
    • Configure a listener for that node.
    • Set the "Event Type" to "Handler Approval Event" (various event types are supported).
    • Set the "Execution Action" to "Business Method".
    • Select the corresponding Business Method that was just created (e.g., "Update Task Status After Approval").
    • Save the configuration.

3.7.4.3 Business Method Types

3.7.4.3.1 Message Notification

Message Notification is primarily used in process events to send messages. It supports five notification methods: To-Do, Email, DingTalk Work Notification, SMS, and WeChat Work Notification.

  • Target Recipient: Select recipients via the organizational structure or by configuring a formula in the formula editor.
  • URL: Configure a URL link, which can point to the current instance (newly created or approved), an external link, or an internal process instance.
  • Notification: Choose from To-Do, Email, DingTalk Work Notification, SMS, or WeChat Work Notification.
  • Message Body:
    • Set the message content by referencing a notification template, customizing the message content, or customizing both the title and content.
      • "Reference Notification Template" sources from "Message Center - Message Templates."
      • "Customize Message Content" requires enabling the "Message Push Method" in "Process Platform - Default Settings".
      • "Customize Title and Content" allows you to adjust the fields included in the message content based on business needs.
  • Default Push Enabled:
    If enabled, messages are pushed according to the configured message format. If disabled, default message content is pushed.
    Note: Business data items display document and form controls, while process data items display variables from the process flow.

3.7.4.3.2 Add Data

Add Data is primarily used for scenarios involving adding instance data to forms.

  • Target Form: Supports selecting any form configured in the template. After execution, data will be added to the selected form.
  • Instance Existence Strategy:
    • Ignore: If the instance exists, the add operation will not be performed.
    • Update: If the instance exists, the form's update interface will be called to update the data.
    • Add Anyway: If the instance exists, the form's add interface will still be called to add new data.
  • Integration Method Settings:
    Configure value assignments for the selected target form fields. During runtime, form instance data will be added based on these settings.
Portal Diagram

3.7.4.3.3 Update Data

Update Data is primarily used for scenarios involving updating instance data in forms.
Example: updating a project's status after project acceptance approval.

  • Target Form: Supports selecting any form configured in the template. After execution, data will be updated in the selected form.
  • If Instance Not Exists:
    • Ignore: If the instance exists, the update operation will not be performed.
    • Update: If the instance exists, the form's update interface will be called to update the data.
    • Add Data: If the instance exists, the form's add interface will be called to add new data.
  • Integration Method Settings:
    Configure value assignments for the selected target form fields. During runtime, form instance data will be updated based on these settings.

3.7.4.3.4 Delete Data

Delete Data is primarily used for scenarios involving deleting instance data from forms.

  • Target Form: Supports selecting any form configured in the template. After execution, data will be deleted from the selected form.
  • Instance Existence Strategy:
    • Ignore and Do Not Execute: If the instance does not exist, the delete operation will not be performed.
    • Call the Delete API: If the instance does not exist, the form's delete interface will be called to delete the data.

3.7.4.3.5 Variable Assignment

Variable Assignment is primarily used for assigning values to process variables or temporary variables.

  • Variable Name: Supports selecting either process variables or context variables.
  • Variable Assignment: Configure the value to be assigned to the variable using the formula editor.

3.7.4.3.6 More

The "More" option supports obtaining values by calling integration methods or directly triggering business logic from the low-code platform.

  • Calling Integration Methods
    • Select Integration Method: Choose the interface to be called from the integration platform.
    • Integration Method Settings: Configure value assignments for the input parameters and return values of the selected interface.
      • Input Parameters: Lists all input parameters for the interface.
      • Return Value: Configure the return value of the interface using the formula editor. It supports returning values to process variables and temporary variables.
  • Dependent Business Method:
    If a dependent business method A is set, business method A will be executed first. If method A executes successfully, the current business method will proceed. If method A fails, the current method will not execute.
  • Execution Restriction:
    When set to "Execute Only Once per Process," the business method will not execute again if the node is rejected and re-flows through it.
  • Asynchronous Execution:
    • Disabled: If disabled, and either the dependent business method or the current business method fails, a process exception will be reported, and the process will enter an abnormal state, requiring manual administrator intervention.
    • Enabled: If enabled, execution failure will not report a process exception, and the process will continue to flow.
      This is suitable for scenarios where strict invocation is not required.
      Business method invocation exceptions will generate exception logs, which can be viewed in the Process Platform Monitoring Center, along with options for manual exception retry.
Portal Diagram

3.7.4.2 Scenario Description

Scenario description: In a task management scenario, after a task completion is confirmed and approved, the system automatically updates the task status within the form.

Configuration Steps:

  1. Design the Task Tracking Form: Ensure that the form page for task tracking is properly designed.
  2. Add a New Business Method:
    • Enter the Business Method Name (e.g., "Update Task Status After Approval").
    • Select the Action Type as "Update Data." The system supports six different types; choose based on your business scenario.
    • Select the Target Form as "Designed Forms."
    • For the "If Instance Not Exists," choose "Ignore" (if the instance already exists, the update operation will not be performed).
    • Click on the “Method Settings” to open a pop-up window.
  3. Method Settings:
    • Select "Object Assignment" in the “Value Setting” dropdown.
    • Assign the "Task Status" field a "Fixed Value" (e.g., "Completed").
  4. Associate Business Method via Listener:
    • Select the relevant node in your process flow.
    • Configure a listener for that node.
    • Set the "Event Type" to "Handler Approval Event" (various event types are supported).
    • Set the "Execution Action" to "Business Method".
    • Select the corresponding Business Method that was just created (e.g., "Update Task Status After Approval").
    • Save the configuration.

3.7.4.3 Business Method Types

3.7.4.3.1 Message Notification

Message Notification is primarily used in process events to send messages. It supports five notification methods: To-Do, Email, DingTalk Work Notification, SMS, and WeChat Work Notification. For example, after an approval, send a message to relevant personnel for follow-up.

  • Target Recipient: Select recipients via the organizational structure or by configuring a formula in the formula editor.
  • URL: Configure a URL link, which can point to the current instance (newly created or approved), an external link, or an internal process instance.
  • Notification: Choose from To-Do, Email, DingTalk Work Notification, SMS, or WeChat Work Notification.
  • Message Body: Set the message content by referencing a notification template, customizing the message content, or customizing both the title and content.
    • "Reference Notification Template" sources from "Message Center - Message Templates."
    • "Customize Message Content" requires enabling the "Message Push Method" in "Process Platform - Default Settings" before customization is allowed.
    • "Customize Title and Content" allows you to adjust the fields included in the message content based on business needs. Click the text box to select business data items or process data items.
  • Default Push Enabled: If enabled, messages are pushed according to the configured message format. If disabled, default message content is pushed. (Note: Business data items display document and form controls, while process data items display variables from the process flow.)

3.7.4.3.2 Add Data

Add Data is primarily used for scenarios involving adding instance data to forms.

  • Target Form: Supports selecting any form configured in the template. After execution, data will be added to the selected form.
  • Instance Existence Strategy:
    • Ignore: If the instance exists, the add operation will not be performed.
    • Update: If the instance exists, the form's update interface will be called to update the data.
    • Add Anyway: If the instance exists, the form's add interface will still be called to add new data.
  • Integration Method Settings: Configure value assignments for the selected target form fields. During runtime, form instance data will be added based on these settings.

Figure 3.7–17 Settings for Add Data

3.7.4.3.3 Update Data

Update Data is primarily used for scenarios involving updating instance data in forms. For example, updating a project's status after project acceptance approval.

  • Target Form: Supports selecting any form configured in the template. After execution, data will be updated in the selected form.
  • If Instance Not Exists:
    • Ignore: If the instance exists, the update operation will not be performed.
    • Update: If the instance exists, the form's update interface will be called to update the data.
    • Add Data: If the instance exists, the form's add interface will be called to add new data.
  • Integration Method Settings: Configure value assignments for the selected target form fields. During runtime, form instance data will be updated based on these settings.

3.7.4.3.4 Delete Data

Delete Data is primarily used for scenarios involving deleting instance data from forms.

  • Target Form: Supports selecting any form configured in the template. After execution, data will be deleted from the selected form.
  • Instance Existence Strategy:
    • Ignore and Do Not Execute: If the instance does not exist, the delete operation will not be performed.
    • Call the Delete API: If the instance does not exist, the form's delete interface will be called to delete the data.

3.7.4.3.5 Variable Assignment

Variable Assignment is primarily used for assigning values to process variables or temporary variables.

  • Variable Name: Supports selecting either process variables or context variables.
  • Variable Assignment: Configure the value to be assigned to the variable using the formula editor.

3.7.4.3.6 More

  • The "More" option supports obtaining values by calling integration methods or directly triggering business logic from the low-code platform.
  • Calling Integration Methods
  • Select Integration Method: Choose the interface to be called from the integration platform.
  • Integration Method Settings: Configure value assignments for the input parameters and return values of the selected interface.
    • Input Parameters: Lists all input parameters for the interface.
    • Return Value: Configure the return value of the interface using the formula editor. It supports returning values to process variables and temporary variables.
  • Dependent Business Method: If a dependent business method A is set, business method A will be executed first. If method A executes successfully, the current business method will proceed. If method A fails, the current method will not execute.
  • Execution Restriction: When set to "Execute Only Once per Process," the business method will not execute again if the node is rejected and re-flows through it.
  • Asynchronous Execution:
    • Disabled: If disabled, and either the dependent business method or the current business method fails, a process exception will be reported, and the process will enter an abnormal state, requiring manual administrator intervention.
    • Enabled: If enabled, execution failure will not report a process exception, and the process will continue to flow. This is suitable for scenarios where strict invocation is not required. Business method invocation exceptions will generate exception logs, which can be viewed in the Process Platform Monitoring Center, along with options for manual exception retry.
Portal Diagram

Figure 3.7–18 Call Integration Method