Creating the Business Service for the Hierarchical List Applet
In this topic, you create the business service for the hierarchical list applet.
To create the business service for the hierarchical list applet
Display the Business Service Server Script object type.
The business service server script is a child of the business service. For more information, see Displaying Object Types You Use to Configure Siebel CRM.
In the Object Explorer, click Business Service.
In the Business Services list, add a new business service using values from the following table.
Property Value Name
Hierarchical List Service
Server Enabled
Check mark
In the Object Explorer, expand the Business Service tree, and then click Business Service Server Script.
In the Business Service Server Scripts list, add a new record using values from the following table.
Property Value Name
Init
Program Language
JS
Sequence
1
Script
Enter the following script:
function Init (Outputs) { with( Outputs ) { SetProperty ("Parent Row Id", ""); SetProperty ("Amount", ""); SetProperty ("Description", ""); // SetProperty ("Has Children", "N"); // SetProperty ("Is Expanded", "N"); // SetProperty ("Outline Number", "0"); // SetProperty ("Last Child Info", ""); } return( CancelOperation ); }
You can copy the text from this book, and then paste it into the Script property. To view the correctly formatted script, right-click Hierarchical List Service in the Business Services list, choose Edit Service Scripts, expand the general tree, and then click Init.
In the Business Service Server Scripts list, add a new record using values from the following table.
Property Value Name
Query
Program Language
JS
Sequence
2
Script
For more information, see Extensive Code Examples That This Book Uses.
In the Business Service Server Scripts list, add a new record using values from the following table.
Property Value Name
Service_PreInvokeMethod
Program Language
JS
Sequence
3
Script
Enter the following script:
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { TheApplication().Trace( this.Name() +".PreInvokeMethod( " + MethodName + " )"); switch( MethodName ) { case "Init": return( Init (Outputs) ); case "Query": return( Query (Inputs, Outputs) ); } return (ContinueOperation); }
Add code to the Query method of the business service so that the method provides output that is meaningful for these fields:
Has Children. Y or N, depending on if the record references children or does not reference children.
Is Expanded. Y or N, depending on if Siebel CRM displays the record as expanded or not expanded in the applet.
Outline Number. A string that describes the position of the record in the hierarchy. For example. 1.2 or 2.1.1.
Last Child Info. A string that represents a binary sequence that indicates if the record and the parent of the record is the last record in the list of children. For more information, see the following section.
The code can be similar to the code that you added in the previous step.
To maintain the values appropriately, add code to the Update method.
The Update method is specific to your custom implementation and requires a mechanism to update the records of the virtual business component. The exception is if all records are read-only, then no Update method is required.
About Last Child Info
The output for Last Child Info in this example is a string of three bits that Siebel CRM displays for each level in the hierarchy if more records exist. Consider the test values in the Query method for this example. The following situations apply for a tree that includes three levels:
If an item exists in the tree that is at position 1.3.2, and if item 1.3.3 does not exist, then the third bit is 1, which you can think of as xx1. Otherwise the third bit is 0, which you can think of as xx0.
If the parent record at position 1.3 is the last child, then the second bit is 1, which you can think of as x1x. If item 1.4 does not exist in the tree, then Siebel CRM considers the record as the last child.
If the grandparent record at position 1 is the last child, and if item 2 does not exist in the tree, then the first bit is 1, which you can think of as 1xx.