Skip to main content
PRERELEASE CONTENT

Defining a Transformation Call Action

Each transformation rule of a template must have a call action, which specifies the actual action to take once a scenario has been chosen. The call action implements the logic needed to resolve the specific supply chain issue, generally by calling third-party APIs.

How a Transformation Call Action Is Used

For each call to the scenario analysis API, once the scenario analysis has been resolved, the system uses the call action of the applicable transformation rule.

If a template has multiple transformation rules, the system identifies the transformation rule associated with the chosen scenario and uses the call action of that transformation rule. For example, the transformation rule to move inventory has a call action that invokes external API calls to move inventory. In the same template, the transformation rule to order more product has a call action to create a PO with a supplier. If a scenario analysis was resolved by choosing to move inventory, the system uses the call action that moves inventory.

Template Syntax

The following template fragment shows a transformation rule so you can see where to include the call action:

    "transformation": {
        "name": "Replenishment Strategies",
        "rules": [
            {
                "description": "Move Inventory from Another Warehouse",
                "name": "Move Inventory",
                 ...
                "callAction": "CallActionForMoveInventoryBPL"
            },...

Formally:

  • The transformation object is a top-level property of the template, and the rules property specifies an array of objects, each of which describes one transformation rule.

  • Each transformation rule includes the callAction property, which should equal the name of the BPL business process to use.

Implementing the Call Action

To implement the call action, create a BPL business process as follows:

  • The business process request class must be SC.Core.BP.Message.CallActionRequest.

    This class has three properties, automatically set by the scenario analysis module:

    • contextId

    • transformationRuleName

    • transformationRuleVersion

  • The OnRequest() callback must call the appropriate external API to make the needed change (to transfer inventory from one warehouse to another, to place a purchase order, or whatever other action is needed).

For example:

Class docs.ScenarioAnalysis.tutorialNew.CallActionForMoveInventoryBPL Extends Ens.BusinessProcess
{

Method OnRequest(request As SC.Core.BP.Message.CallActionRequest, 
                 Output response As Ens.Response) As %Status
{
    set status = $$$OK
    Try {
        //Using information from request, call API to communicate with external system
    } Catch (ex){
        return $$$ERROR($$$GeneralError, ex.DisplayString())
    }
    return status
}

}

Checklist

  • Create the BPL.

  • Add the BPL to the Supply Chain production and enable it.

  • Within the BPL, log any errors as well as any intermediate steps that are useful for debugging.

  • Update the template as shown above.

  • Implement the rest of the transformation rule.

FeedbackOpens in a new tab