Within a workflow process, you can store a property set in a process
property of type Hierarchy. To pass the content of a process property to
or from a custom business service, however, the Type of the child
property set stored in the process property must match the name of the
input or output argument of the business service.
The following two examples demonstrate this principle.
Example 1: Getting a Property Set from a Business Service
This example shows how to set up a workflow process to invoke a
custom business service, and retrieve a process property that is in a
hierarchal property set.
-
In Siebel Tools, create a business service, MyBS, defined with the following method and arguments:
Method Name: Method1
Arguments:
Name Data type Type Display name Storage Type Optional HierarchyArg1 Hierarchy Input / Output Hierarchy Argument 1 Hierarchy True
Add the following Server script (eScript):
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
if (MethodName == "Method1") {
var outPropset = TheApplication().NewPropertySet() ;
outPropset.SetType("HierarchyArg1") ;
outPropset.SetProperty("PropName1", "Hello") ;
outPropset.SetProperty("PropName2", "Goodbye") ;
Outputs.AddChild(outPropset) ;
outPropset = null;
return (CancelOperation);
}
else return (ContinueOperation);
}
Create a workflow process, myWF, with a process property defined as follows:
Name: myHierarchy
Data Type: Hierarchy -
You can name this process property with any name you choose. This
process property name becomes the Type of your output property set.
- Add a business service step to the workflow process defined as
follows to invoke the business service you created in steps 1 and 2:
Business Service: MyBS
Method: Method1
- For the output argument of the business service step, add a record as follows:
Property Name: myHierarchy
Type: Output Argument
Output Argument: Hierarchy Argument 1 The execution of this step puts the property set built in the myBS business service into the myHierarchy process property. Please refer to the Note at the end of this FAQ for additional information about this step.
-
Run the workflow process in the workflow process simulator. At the
end of the business service, the myHierarchy process property with the
following structure is available:
Type Value Child Type myHierarchy HierachyArg1 Type Value Property Key Property Value HierachyArg1 PropName1 Hello PropName2 Goodbye
Example 2: Passing the Process Property to a Business Service
This second example builds on the workflow and business service
developed in Example 1 and assumes that you have a workflow process with
a hierarchy process property that has been initialized by another step.
This example shows how to pass a property set from a workflow process
to a business service. For this example, the Type of the property set
must be stored within this process property.
In Example 1, the step calling the MyBS business service returned a
property set with a Type of HierarchyArg1 into the myHierarchy process
property. In this example, this process property is passed to another
business service called MyBS2 using the Method2 method.
-
Create a new business service named MyBS2 and define it with the following method and argument (created in Siebel Tools):
Method Name: Method2
Arguments:
Name Data type Type Display name Storage Type Optional HierarchyArg1 Hierarchy Input / Output Hierarchy Argument 1 Hierarchy True -
Add the following Server script (eScript) to the business service:
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
if (MethodName == "Method2") {
var childPropset = TheApplication().NewPropertySet();
childPropset = Inputs.GetChild(0);
var a = childPropset.GetProperty("PropName1");
var b = childPropset.GetProperty("PropName2");
var outPropset = TheApplication().NewPropertySet();
outPropset.SetType("HierarchyArg1");
outPropset.SetProperty("PropName3", a+b);
Outputs.AddChild(outPropset);
outPropset = null;
childPropset = null;
return (CancelOperation);
}
else return (ContinueOperation);
}
Modify the workflow process from Example 1 to add another business service step and a new process property of type hierarchy called myHierarchy2. -
The business service step invokes the MyBS2 business service you
created above. This step should be added after the step that invokes the
MyBS business service. In that step, pass it the process property as
indicated below:
Business Service: MyBS2
Method: Method2
-
Add a record into Input Arguments applet as follows:
Input Argument: Hierarchy Argument 1
Type: Process Property
Property Name: myHierarchy
- For the output argument of the business service step, add a record as follows:
Property Name: myHierarchy2
Type: Output Argument
Output Argument: Hierarchy Argument 1
The execution of the MyBS2 business service step passes the content of the myHierarchy process property (a hierarchical process property) into a child property set having a Type of HierarchyArg1. The HierarchyArg1 property set is received by the Service_PreInvokeMethod function of the MyBS2 business service.
- Run the workflow process in the workflow process simulator. At the
end of the business service, the myHierarchy2 process property with the
following structure is available:
TypeValue Child Type myHierarchy2 HierachyArg1
Type Value Property Key Property Value HierachyArg1 PropName3 HelloGoodbye
This figure above
shows an overview of how data is passed to and from a business services
and workflow process. It shows the relationship between the workflow
process property set and the Inputs and Outputs property sets for
business services and presents the mechanism for workflow process
described in above Example 2. The workflow process definition is at the
top of the figure. The dotted blue lines show in a workflow process, to
retrieve a hierarchal process property from a business service, the name
of the output argument of the business service must match the child
Type of the process property.
Note. In
above steps (Example 1, step 5 and Example 2, step 4) the Output
Argument and Input Argument columns show the display name of the
argument, not its name. This is the reason why the Type of the property
set is HierarchyArg1 and not Hierarchy Argument 1.
0 comments:
Post a Comment