How Do You Pass or Receive a Property Set to or from a Custom Business Service?

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.

  1. In Siebel Tools, create a business service, MyBS, defined with the following method and arguments:

    Method Name: Method1
    Arguments:

    NameData typeTypeDisplay nameStorage TypeOptional
    HierarchyArg1HierarchyInput / OutputHierarchy Argument 1HierarchyTrue

    The name of the argument, for example, HierarchyArg1, must match the Type of the child property set in the business service script.

    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
  2. You can name this process property with any name you choose. This process property name becomes the Type of your output property set.

  3. 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
     
  4. 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.

  5. 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:

    TypeValueChild Type
    myHierarchy HierachyArg1
    TypeValueProperty KeyProperty Value
    HierachyArg1 PropName1Hello
      PropName2Goodbye

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.

  1. Create a new business service named MyBS2 and define it with the following method and argument (created in Siebel Tools):  

    Method Name: Method2
    Arguments:

    NameData typeTypeDisplay nameStorage TypeOptional
    HierarchyArg1HierarchyInput / OutputHierarchy Argument 1HierarchyTrue
  2. 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.
  3. 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

  4. Add a record into Input Arguments applet as follows: 

    Input Argument: Hierarchy Argument 1
    Type: Process Property
    Property Name: myHierarchy

  5. 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.
     
  6. 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:

    Type

    ValueChild Type
    myHierarchy2 HierachyArg1

    TypeValueProperty KeyProperty Value
    HierachyArg1 PropName3HelloGoodbye

 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.

Tags