As usual, let's see what we want to achieve:
Click to enlarge. |
This solution should be applicable to all list applets. In this and the following post, I will lay out the steps to achieve a generic solution for the requirement presented above. The example solution focuses on numeric columns but can be easily applied to other data types as well.
The following are the main ingredients:
- Applet User Properties
- Custom Presentation Model
- Custom Physical Renderer
Today, we'll focus on the first two points:
Using Custom Applet User Properties in Siebel Open UI
As a frequent reader of this blog, you are aware of the ClientPMUserProp applet user property introduced with Innovation Pack 2013. This user property is used by Oracle to define standard applet behavior such as drag and drop to and from list applets or collapsible/expandable headers.
We can also define our own custom user properties and - as they will be forwarded to the Open UI framework - can use them in the browser-side code to control the behavior of our customizations.
To implement the conditional formatting example, I chose to define two custom user properties:
- CF Field List: A comma separated list of business component fields which - should they be exposed as list columns - will be conditionally formatted.
- CF Threshold List: A comma separated list of numeric values which defines the default target values for the respective fields.
To add these user properties to an applet, we have to edit the applet in Siebel Tools and do the following:
- Open the list of Applet User Properties for the applet.
- Create three new user property records as follows:
Name | Value |
ClientPMUserProp | CF Field List, CF Threshold List |
CF Field List | Primary Revenue Amount,Primary Revenue Win Probability |
CF Threshold List | 500000,50 |
The above settings apply to any list applet using the Opportunity business component, for example the Opportunity List Applet.
Here is a screenshot documenting the work:
Click to enlarge. |
With this technique we can define a list of fields which should be conditionally formatted and the default target value for any list applet. Of course the field names must match exactly those of fields available in the applet's BC.
Ah, and yes, don't forget to compile the applet(s).
Accessing Custom User Properties in a Presentation Model
Any user property defined in the ClientPMUserProp value will be propagated to the property set used to set up the presentation model of the UI object.
As Siebel Bookshelf states, we can currently do this with individual controls, applets or views. To be able to access the values of the custom user properties, we must extend the presentation model and override the Setup method of the custom PM. This is because the Setup method receives a reference to the current object's property set.
The following code shows the Setup method of a custom presentation model extension class, accessing the user properties we created above.
Click to enlarge. Example code for IP 2013 (8.1.1.11) |
As you can see, we use a reference to the Oracle-defined set of constants to retrieve the name of the property set containing the applet user properties (SWE_APPLET_PM_PS). This is a recommended practice to avoid issues should Oracle engineering decide to change the naming convention in a future release.
Then we can use the GetProperty method of the property set to retrieve the values of the two custom user properties we created in the first step in Siebel Tools and store them as "local" PM properties so that we can easily access them from the physical renderer.
The custom presentation model must be administered in the manifest as usual and associated with a test list applet (recommended) and later with the DEFAULT LIST APPLET entry (IP 2013 and later). For testing purposes it is recommended to use a single test applet and use SiebelJS.Log() to print the user property values to the browser's JavaScript console.
The Story so far
With the above configurations, we have set the foundation for writing a generic physical renderer extension for list applets which evaluates the user properties and formats the respective list columns accordingly.
Please stay tuned for the second part of this mini-series where we will discuss a possible approach for this solution.
have a nice day
@lex
אין תגובות:
הוסף רשומת תגובה