Wednesday, October 6, 2010

Unified Messaging Service Framework: Wealth of Messages

Many times we have resorted to browser scripts for displaying message and based on the input given have decided steps to follow but with the introduction of UMS the dependency on the browser script can be avoided. We can do wonders with the UMS framework which can really help in orchestration of system.

UMS is highly used in Order Management however Siebel is kind enough to allow us to use this for any other standard BO. However we need certain level of customization and scripting to achieve this. The main advantage of this framework is to invoke popup applets from workflow. I was not sure whether it was possible or not but as they say absence of evidence is not evidence of absence. A more than little help from support web and universal buddy Google made it. The details of Unified Messaging Service is available in OrderManagement guide. Here we will try to construct and invoke message from Service Request List Applet. It will display snapshot of Service Request which will help SR agent to work upon certain actions. Make sure you are working on SIA application. This goes in three steps:

1 - Creation of Message Type to be displayed.

a ) Navigate to Administration- Order Management -> Message Types.Create new record with following fields:

Name: Testing UMF
Display Mode: Active
Group:Internal Error Message
Title: Testing UMF
Short Text: Testing UMF
Full Text: Status: [Status]
Account: [Account]
Deparment: [Department]
Product: [Product]


b ) Navigate to Payload Tab. Define input payload fields as below:
Status
Account
Department
Product
These parameters will be replaced to actual values at runtime.


c ) Navigate to Response Tab this will hold the business service and method name to be invoked on clicking responses. Create following record in Response applet.

Sequence: 1
Name: Assign\ReAssign
Business Service: ResponseService // We will write this business service in later steps. Initially it can be left blank.
Method: AssignRequest

Sequence: 2
Name: Additional Information
Business Service: ResponseService
Method: AddInfo

Sequence: 3
Name: Opinion Request
Business Service: ResponseService
Method: OpReq

Now our Message set is done. Its time to invoke this message from applet. We will keep business service null for time being.

2 - Add the required BC's in the Service Request business object including "UMF Active Message Virtual BusComp", "UMF File Handler","UMF Passive Message Virtual BusComp".Navigate to Service Request List Applet. Add a button on the list applet with method as "Popup". Open script editor for this and add below script. This script will create message hierarchy at runtime to be invoked on button click.

if(MethodName == "Popup")
{
// Local declaration
var obj_UMS; // Business Service "Unified Messaging Service"
var obj_Inputs_PS; // Property Set used as inputs for UMS business service
var obj_Outputs_PS; // Property Set used as outputs for UMS business service
var obj_MessageList_PS; // Property Set used to construct the list of messages to be sent to UMS business service
var obj_Message_PS; // Property Set used to construct the message to be sent to UMS business service
var obj_Payload_PS; // Property Set used to construct the list of payload-value pairs be sent to UMS business service
var str_ErrMsg; // Used to create error message strings

// Variables initialization
obj_UMS = TheApplication().GetService("Unified Messaging Service");
obj_Inputs_PS = TheApplication().NewPropertySet();
obj_Outputs_PS = TheApplication().NewPropertySet();
obj_MessageList_PS = TheApplication().NewPropertySet();
obj_Message_PS = TheApplication().NewPropertySet();
obj_Payload_PS = TheApplication().NewPropertySet();
obj_Payload_PS.SetType("Payload");
//Creating Paload
obj_Payload_PS.SetProperty("Business Component","Service Request");
obj_Payload_PS.SetProperty("Status",this.BusComp().GetFieldValue("Status"));
obj_Payload_PS.SetProperty("Account",this.BusComp().GetFieldValue("Account"));
obj_Payload_PS.SetProperty("Department",this.BusComp().GetFieldValue("Department"));
obj_Payload_PS.SetProperty("Product",this.BusComp().GetFieldValue("Product"));
// Build message property set
obj_Message_PS.SetType("Message");
obj_Message_PS.SetProperty("Score", "100");
obj_Message_PS.SetProperty("Message Id", this.BusComp().GetFieldValue("Id"));
obj_Message_PS.SetProperty("Message Type", "Testing UMF");
obj_Message_PS.SetProperty("Display Mode", "Active");
obj_Message_PS.AddChild(obj_Payload_PS);

// Build message list property set
obj_MessageList_PS.SetType("Message List");
obj_MessageList_PS.AddChild(obj_Message_PS);
obj_Inputs_PS.SetProperty("Source", "SR Messages");
obj_Inputs_PS.AddChild(obj_MessageList_PS);

// Submit message to the unified messaging service
obj_UMS.InvokeMethod("AddMessages", obj_Inputs_PS, obj_Outputs_PS);
return (CancelOperation);
}

we can also write a business service and call that business service from workflow and invoke that workflow on button click. After compilation on button click following popup will appear.

The next important step is to capture responses and define appropriate actions. We will cover this in the next post till then stay tuned.

No comments: