Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Canvas facilitates the purpose of using additional ready-made activities, supported by Request Modeler. For more information on the activities, supported by Request Modeler and their associated instruction classes, refer Activities. For the full set of information on stateModelLibrary.json, refer Library JSON.

Info

Before pre-confirmation screen in Request Modeler, the form data that is sent through the request can be accessed using $context.FORM_ITEM_ID or $context.formmodelkey.

Dynamic values in Request Modeler can be accessed as follows:

  • $response - To get response data set in one activity.
  • $response.serviceResp - To get web service response.
  • $user - To get user related data.


Connecting to a Web Service using existing Data Source ID

The The connectToWS activity of connectToWS facilitates the purpose of using the existing data source ID to connect to the web service. The following code snippet is a sample reference to use this the connectToWS activity in stateModelLibrary.json:

Code Block
{      
	"id" : "W01",
	"type" : "connectToWS",
	"datasourceId" : "WS_DS" //existing data source ID
}

Updating the Request Data

The The updateDB activity of updateDB paves the way for updating the request data by specifying the model /or request Id ID and the relevant fields that require appropriate updates. The following code snippet is a sample reference to use this the updateDB activity in stateModelLibrary.json:

Tip

The fieldValue can be applied from the context value or you can even use the default or static value.

...

Code Block
{
	"id" : "DB01",
	"type" : "updateDB",
	"modelId" :"CARD_REQ", //optional
	"fieldList" :

		[{
			"fieldName" : "CARD_TYPE",
			"fieldValue" : "$response.serviceResp.status",
			"defaultValue" : "Debit"
		 },
		 {
			"fieldName" : "CARD_NO",
			"fieldValue" : "$context.OLD_CARD_NO"
		 }]
}


Note

The model ID can be passed from the client side. If the model ID is passed through JSON and the client side, then the JSON will get the top priority. It is feasible if you pass the model ID either as a JSON parameter or from the client side.

...

Sending Responses to the Client

The The setClientResponse activity of setClientResponse can be used to send a response to the client by giving appropriate keys and relevant values in fieldList. The following code snippet is a sample reference to use this the setClientResponse activity in stateModelLibrary.json:

Code Block
{
	"id" : "RESP01",
	"type" : "setClientResponse",
	"fieldList" :

	{
		 "updatedCardNo" : "$context.OLD_CARD_NO",
		 "serviceStatus" : "$response.serviceResp.status"
	}
}

Raising Events based on Event Configuration

The The processEvents activity of processEvents can be used to raise events based on event configuration in stateModelLibrary.json. The events can also be raised from the existing model data. Events need to be mapped with respective alerts and audits. The following code snippet is a sample reference to use this the processEvents activity in stateModelLibrary.json:

Note

As of nowCurrently, only default values can be used. If no values are assigned, then the model data will be automatically considered as eventData.

...

Code Block
{
	"id" : "PE01",
	"type" : "processEvents",
	"eventConfig" :
	{
		"productCode" : "CUSER",
		"subProductCode" : "CUSER",
		"functionCode" : "VIEW",
		"action" : "ADD",
		"eventData" :
		{
			"ADD_KEY" : "ADD_VALUE"
		}
	}
}

...

Code Block
var eventConfig = 
	{
		"productCode" : "CUSER",
		"subProductCode" : "CUSER",
		"functionCode" : "VIEW",
		"action" : "ADD"
	}
fm.model.setValue("eventConfig",eventConfig);

...

The post publish activities can be used to initiate a particular action (such as Submit or Approve), from the server-side hook. Activities like updating the database and publishing requests can be carried out in a feasible manner. Assuming that the Flag introduced is POST_PUBLISH.

  1. While creating a request in Canvas Studio, specify "POST_PUBLISH" : "Y" in Additional Params field, so as to proceed with post publish activities. For the relevant information on creating a request in Canvas Studio, refer Configuring Request Modeler and Creating Library Request. The following code snippet is a sample reference on adding the post publish activities, involving the Submit action of Submit in stateModelLibrary.json:

...

Code Block
{
	"id" : "AO",
    "description" : "Ready For Authorization",
    "isDefault" : "false",
    "actions" :

	[{
		"id" : "SUBMIT",
        "description" : "When a pre confirmation is submitted",
        "transactionRequired" : "true",
        "isInEditMode" : false,
        "activityChain" :

		[{
			"id" : "DB01",
			"type" : "updateDB",
			"modelId" :"CARD_REQ",
			"fieldList" : 
			[{
				"fieldName" : "CARD_TYPE",
				"fieldValue" : "$response.serviceResp.status"
			},
			{
				"fieldName" : "CARD_NO",
				"fieldValue" : "$context.OLD_CARD_NO"
			}]
		}]
	}]				                  
} 		

...