יום שני, 3 בפברואר 2014

Siebel Open UI: View PRs - Sort 'em out

Thanks to Jan again for this guest article

***

In prior releases of Open UI most configurations were limited to a single applet. Presentation Models (PMs) and Physical Renderers (PRs) could be reused for different applets but - apart from CSS changes - there was no documented way to provide changes outside of applets or enable configuration that spawned more than a single applet. Most of the time such changes ended up in the (undocumented) postload.js.

A feature that didn't make it into the first release of IP2013 but ended up in the first patchset are PMs and PRs for views  (I am pretty sure that I saw this documented in the release notes of patchset 1 - unfortunately I am unable to find the note - please drop me a note with the link if you have the URL at hand).

In case you are unfamiliar with the new concepts of patchsets have a look at Latest recommended maintenance pack for Siebel Open UI on Siebel Version 8.1.1.x and Version 8.2.2.x [Document 1535281.1]  which states:

 "For Siebel CRM version 8.1.1.11 and 8.2.2.4 (Innovation Pack 2013, also known as IP2013), Siebel Open UI fixes will no longer be shipped in monthly quick fix (QF) format but be part of the monthly IP2013 patchsets. For IP2013, regular fixes (including Siebel Open UI fixes) will be shipped as part of monthly bundles called Siebel IP2013 patchsets. These fixes also, are cumulative, meaning the fixes included in IP2013 Patchset 1 will be included in IP2013 Patchset 2".

View PM and PRs significantly mitigate the need to add code to postload.js. In the following we look at an example that enable two things in the vanilla view Contact Summary View:
  1. Making all applets in a view resizable
  2. Allowing to drag&drop applets without loosing a grid layout.


Creating a View PR follows the same steps as creating an Applet PR:

First, we create the PR code proper and save it in the custom folder. Kudos to Duncan Ford who wrote the first version of this View PR. 
    Click to enlarge
    As bookshelf doesn't contain any reference to View PRs (yet?) I spent a bit of time looking at the different events. So far I found four methods that are called:
    1. Init: the first method that is called. In the example, we use a complex looking CSS selector to identify the bottom four applets in our view. Afterwards we flag them with a class and and unique id and apply the JQuery-method sortable to the applets. This allows to drag and drop the four bottom applets in the view.
    2. Setup
    3. SetRenderer: In the example we iterate through all applets in the current view and apply the JQuery-method resizable to them which allows to dynamically resize all applets. SetRenderer is the first method in the chain in which GetAppletMap returns a list of applets. In Init and Setup the method returns an empty array.
    4. EndLife - called when a user navigates to a different view. It seems that it gets called twice.
    5. None of the methods seem to provide any predefined behavior but are just empty hooks. As an interesting matter of fact, ShowUI, BindData and BindEvents -as used by Applet PRs - are not called for View PRs. In case you are intested in the details have a look at the proxy file pmodel.js which defines the root class for View PMs.
      Using the new manifest view we need to register the custom .js file and link it against a view. Apart from selecting a type View instead of Applet in the UI Objects applet there is no difference to the process described in Siebel Open UI Manifest Administration Changes in IP 2013.

        Click to enlarge
        Playing around with the example it is obvious that the code is not production ready:
        1. It is possible to resize applets in a way that make them unusable.
        2. Changes are not persistent - refreshing the view makes all changes void. However, it should be simple to store the information in cookies as explained in Siebel Open UI Tab Layout: Sort 'em out - Part 2
        In summary, View PRs and PMs open up a new range of configuration options and significantly reduce the need to add code to postload.js. Documentation is essentially non-existent at the moment but using the knowledge from applet PMs and PRs it is easy to create PMs and PRs for views.

        have a nice day

        Jan

        אין תגובות:

        הוסף רשומת תגובה