BPL Tutorial for Supply Chain Orchestrator
In InterSystems Supply Chain Orchestrator™, issue analysis and resolution logic is provided by business processes within an interoperability production that you create and configure. The production needs to include business processes, each of which analyzes a specific kind of issue. You can create each business process in the Management Portal, using a graphical editor that creates a business process that contains Business Process Logic.
This tutorial covers the steps in the business process design/configuration that are required to connect the business process to the rest of the issue resolution logic provided by the product, apart from creating workflow scenarios, discussed separately.
Also see the online learning path Building Smart Real-Time Supply Chain ApplicationsOpens in a new tab, which includes information on creating these BPL business processes. For more basic information, see this online trainingOpens in a new tab and product documentation.
Typical Structure
A typical business process for issue analysis has the following overall sequence:
-
Initialize the context. This step keeps track of the issues and related business objects in the context object.
-
Perform the analysis. Within this analysis:
-
Specify analysis values, specifically the severity, urgency, root cause, and impact analysis of the issue.
-
If you are using workflow, use the <call> element to call the workflow operation at the appropriate points.
-
If you are using workflow, use the add-on tools to create recommendations for the workflow users. If the business process offers options for issue resolution, some extra steps are required to access the option details; see Adding Workflow Scenarios.
Because the analysis is necessarily dependent on your use cases, the tutorial shows only parts of this.
-
-
Save the analysis results back to the issue, so the results can be accessed through APIs and UI.
Context Initialization
To initialize a business process for use in Supply Chain Orchestrator, do the following:
-
On the Context tab, specify the following values:
-
Request Class — SC.Core.BP.Message.IssueAnalysisRequest
-
Response Class — Ens.ResponseOpens in a new tab
-
Context Class — SC.Core.BP.IssueContext (or a subclass of this class)
-
-
As one of the initial steps in the BPL, use an <assign> element to set context.issueId as follows:
-
In many cases, an issue is tied to an instance of a business object or transaction, such as an order or a shipment. To make information about that object available to the BPL process, add a <code> element to retrieve the needed value and assign it to a property of the context object. Do this as one of the initial steps in the BPL.
To retrieve the business object or transaction affected by the instance, use the syntax context.getImpactedObject() as shown here. The getImpactedObject() method is provided by chosen context class (SC.Core.BP.IssueContext). For example:
-
As one of the initial steps in the BPL, use an <assign> element to set context.analysis.processName equal to the request.targetProcess, as follows:
This step saves the business process name to the context, so it can be saved back to the issue with the analysis results. This is needed because different business process can be used to analyze the same issue.
Specifying Analysis Values
Once you have set up the context, add additional steps that contain the actual business logic to determine the severity, urgency, root cause, and impacts, and so on. This tutorial does not show those details. As you determine those values, save them to the context.analysis object; see Analysis Properties for names of the properties.
To specify the analysis values, use multiple <assign> elements, each of which sets one property. For example:
Analysis Properties
The analysis object is defined by the class SC.Core.Data.Internal.IssueAnalysis, which has the following properties for you to set as described here:
-
severity — Specifies the severity of the issue, on a numeric scale.
-
urgency — Specifies the urgency of the issue, on a numeric scale.
-
rootCauseAnalysis — Describes the root cause of the issue, in user-friendly terms.
-
impactAnalysis — Describes the results of the analysis, in user-friendly terms.
For data types and length limits, view SC.Core.Data.Internal.IssueAnalysis in the local class reference or in your choice of IDE.
Saving the Analysis Results to the Issue
After the business logic is completed, the BPL must include a <code> element that saves the analysis details back to the issue:
-
If the business process does not contain workflow, use the following syntax to save the analysis to the issue:
do context.saveAnalysisToIssue()
For example:
-
If the business process does use workflow, the <code> element instead requires two lines of code:
set context.analysis.workflowId = $listget(process.%MasterPendingResponses.GetAt(1),1) do context.saveWorkflowAnalysisToIssue()
The extra step saves the workflow ID which can be used later if the workflow needs to be cleared up due to a new round of analysis being executed before the current workflow is closed.
Testing the Business Process
After configuring a business process for issue analysis, you can manually run the analysis on an issue through an API.
You can also use the analytics APIOpens in a new tab, which includes a way to run an issue analysis using a specified business process and then retrieve the analysis results. To run an issue analysis, use the following API call:
POST {{IRIS-SERVER}}/scbi/v1/runissueanalysis/ISSUE_ID
with the following JSON message in the body:
{ "processName": "Your business process name" }
If this call returns successfully, you can use the following API call to retrieve the analysis details:
GET: {{IRIS-SERVER}}/scbi/v1/issues/ISSUE_ID
The following is a sample response:
{
"ID": "877",
"recordCreatedTime": "2022-10-15T14:32:55.472Z",
"lastUpdatedTime": "2022-10-17T09:50:35.180Z",
"description": "Sales orders which were shipped late compared to the committed ship date",
"triggerType": "KPI",
"triggerObjectId": "SalesOrderLateShipVsCommitted",
"impactedObjectType": "SalesOrder",
"impactedObjectId": "d60924c1-ec18-4de8-963d-c569d75fb201",
"severity": 2,
"urgency": 3,
"status": "workflow",
"latestAnalysis": {
"recordCreatedTime": "2022-10-17T09:50:35.174Z",
"lastUpdatedTime": "2022-10-17T09:50:35.179Z",
"issueId": 877,
"runSequence": 3,
"processName": "MfgOrderProcess",
"severity": 2,
"urgency": 3,
"rootCauseAnalysis": "Order expected to be late due to a delayed maintenance
caused by a late shipment of a part needed. ",
"impactAnalysis": "Serious customer satisfaction concerns, and a penalty of $50K.",
"workflowId": "54",
"status": "workflow",
"resolution": "none",
"scenarios": [
{
"optionNumber": "A",
"optionName": "Option A",
"description": "Move the sales order to Hamburg plant",
"costImpact": 1500,
"timeImpact": 36,
"supportingData": "Impact: The order will be fulfilled on time, with
extra $1500 shipping cost. Extra work load on Hamburg plant will
require an early maintenance window.",
"feasibility": 1,
"recommended": 1
},
{
"optionNumber": "B",
"optionName": "Option B",
"description": "Wait for the part, complete the maintenance, and
use expedited shipping once done.",
"costImpact": 500,
"timeImpact": 0,
"supportingData": "Impact: $2000 extra shipping cost. Order expected
to be 2 days late.",
"feasibility": 1,
"recommended": 0
},
{
"optionNumber": "C",
"optionName": "Option C",
"description": "Leverage spare parts in Munich plant and redirect
current shipment to Munich.",
"costImpact": 12000,
"timeImpact": 0,
"supportingData": "Impact: Current sales order will be done on time,
but this will put $250,000 revenue at risk at Munich plant due to
the delayed maintenance.",
"feasibility": 1,
"recommended": 0
}
]
}
}