Siebel IP14: Double-Click for Pick and Shuttle Applets

Update Feb 27th – Double-click issue on MVG resolved 🙂 Added the new physical renderer to the bottom of the post.

I’m sure that most among us have been double-clicking on Pick Applets in Open UI trying to select a record and close the applet. Well, like it used to work in the old days. In these new days this (still) isn’t a boxed feature unfortunately. But who knows what future Innovation Packs will bring to the table… That said: it was so annoying to me, I decided to spent some time finding a solution.

Approach – Extending the Default List Renderer

For Pick Applets I was done within half an hour or so. I found that Popup Applets like Pick Applets and Shuttle Applets are based on the same JQ Grid Renderer class, as regular List Applets. I started by extending the out-of-the-box Physical Renderer for List Applets. You might not know, but within Manifest Administration you will find a number of record if you query for Type=Applet and Name=DEFAULT*

DefaultListRenderersMA

Extending the Default List Renderer means a global change to the application. That said, solutions like these come with a warning: be careful. A simple typo could have wide-spread effects. Plus, since all of the code would be executed pretty much anywhere in the application where List Applets are used, it also means to consider very well if such a global impact would be wise.

Given the warning, this is how I went about. First step as always is to create a piece of boiler plate code to start with. Really, this should always be your starting point. I named it “DefaultPopupListDblClickRenderer”, could have been shorter, but it explains more or less what it’s about.

Since I like the option to enable/disable functionality through Manifest Administration, I tend more and more to use simple Manifest Expressions such as:

ManifestExprDblClick

Next I added the boiler plate code and tested if it got successfully downloaded. The boiler plate code does include some basic logging for the different events, which is useful to test whether the code actually gets executed or not.

DefaultPopupPR

Well, the boiler plate code was working just fine. So I added just added in some basics. First getting the FullId of the Applet and additionally a debugger statement. Adding the debugger statement is a feature I often use, because it enables one to use the console to test any JQuery selectors for example. Very, very useful.

var pm = this.GetPM();
var placeHolder = "s_" + pm.Get("GetFullId") + "_div";
console.log("placeHolder: " + placeHolder);
var that = this;
debugger; 

So next step was to identify using Inspect Element what the DOM looks like when a Pick Applet gets displayed. If we would know how to identify an element to which we could bind a double-click event, we would be one step further. This went down pretty smooth ending up with the following code snippet:

$("#" + placeHolder).find(".ui-jqgrid-view").dblclick(function() {
     if ($("#" + placeHolder).find(".AppletStylePopup").find(".siebui-icon-pickrecord").length > 0) 
        that.GetPM().ExecuteMethod("InvokeMethod", "PickRecord");
});

To isolate the double click event once it fires from regular list applets, I found that every Popup would carry a “.AppletStylePopup” class a bit down in the DOM, so I added the conditional statement to isolate the event. Final step was simple, just invoke the “PickRecord” event against the applet. Job done!

Guess what? Works flawlessly.

I got in a good mood, and though about extending the functionality towards Shuttle Applets too. These are also Popup Applets, but a special kind. It took a bit more effort plus collaboration with Duncan Ford.

As we know a Shuttle Applet consists out of two applets. The left side is an Association List, the right side is a MVG. Idea would be that a double click on the left side would “add” the record to the MVG and vice versa. Simple enough.

It appears that the Association List is carrying a specific Id of “#sieb-ui-popup-mvg-available”. Great. So traversing a bit further down the DOM you would find the actual list carrying the class “.ui-jqgrid-view” to which we should bind our double-click event.

Next it appeared that solely using GetPM().InvokeMethod(“AddRecord”) did not work flawlessly. Yes, it would add the record to the MVG. But the state of the Association List got inconsistent. Having the AddRecord invocation being directly followed by an ExecuteQuery does the job just fine.

$("#" + placeHolder).find("#sieb-ui-popup-mvg-available").find(".ui-jqgrid-view").dblclick(function() {
    that.GetPM().ExecuteMethod("InvokeMethod", "AddRecord");
    that.GetPM().ExecuteMethod("InvokeMethod", "ExecuteQuery");
});

Finally removing a record from the MVG! It works very well using the same approach taken for the “AddRecord”. The Element to look for is the #sieb-ui-popup-mvg-selected and then again the .ui-jqgrid-view class, as such:

$("#" + placeHolder).find("#sieb-ui-popup-mvg-selected").find(".ui-jqgrid-view").dblclick(function() {
    that.GetPM().ExecuteMethod("InvokeMethod", "DeleteRecords");
    that.GetPM().ExecuteMethod("InvokeMethod", "ExecuteQuery");
});

Given the few lines of code, I feel the benefit is there 🙂

You can grab the code here.

– Jeroen

20 thoughts on “Siebel IP14: Double-Click for Pick and Shuttle Applets

  1. Hi Jeroen,

    I like what you’ve done here, and have successfully implemented it. However, I found a bug which I haven’t managed to get resolved. When I add the PR to the DEFAULT_LIST_APPLET, it works well everywhere but it also *breaks* the Contact Map View functionality: clicking on the Map button in the top right hand corner of the Visible Contact List View does not render a map. Any clues?

    • Hi Duncan,

      This is indeed interesting. I tested the same, but in my environment it does not break the Map renderer for the Visibile Contact List View. Would you see in your console any js errors perhaps which could give a lead? Does this happen across browsers? I have currently two customers using this particular PR in development stages, so far have not heard further abnormalities. – Jeroen

      UPDATE March 11th: I tested again, and in my environment too, it broke the map renderer. Need to dig a bit deeper into this..

  2. It Worked like a charm. However i am facing the same issue Duncan raised earlier.
    I tried inactivating the new manifest admin for DEFAULT LIST APPLET, Contact Map started rendering.

  3. It doesn’t work for me… I used the PR file as it is.. And used a specific applet instead of the default one… Is there anything I am missing?

    Please help!
    FYI: I work on IP 2013

    • Sorry, I overlooked your comment. I did not test on IP13. Can well imagine it will not work in IP13, because it ties very much into the DOM. DOM will not be equivalent between 13 and 14 I’m afraid. That said, it should be feasible in IP13 too, but that would require re-work on the solution (straight-forward I belief). But I do not have an IP13 instance to test this.

  4. Hi Jeroen,

    Thanks for your soution.

    Is there any way to Trigger the above soution only for the Pick Applets. Since if we trigger the above solution on DEFAULT LIST APPLET then we can see some issues with List Applets which has Other PM/PR files associated.

    Best Regards,
    Ashok Ambati

  5. I had to modify it a bit to make it work. My problem was on this line: if ($(“#” + placeHolder).find(“.AppletStylePopup”).find(“.siebui-icon-pickrecord”).length > 0) . For me there is no “siebui-icon-pickrecord”.

    • Hi,

      You cannot add Siebel seed data, so you have to add a custom ‘Applet’ / ‘Presentation Model’ for DEFAULT LIST APPLET. But please beware, this is not fot the faint-hearted. As written in the post, really you should be careful. At the time of writing, Siebel evaluates the manifest administration and the first entry which evaluates true ‘wins’:

      This is the evaluation process behind the scenes:
      1. Is there a custom applet-specific renderer/model
      2. Is there a custom default renderer/model
      3. Is there a seeded applet-specific renderer/model
      4. Is there a seeded default renderer/model

      You might see what happens when you create your own DEFAULT xxx APPLET? It would obsolete any seeded applet specific or default renderers or presentation models.

      This behavior will be addressed, though I cannot yet tell when it will be changed. The straight-forward solution would be:

      1. Is there a custom applet-specific renderer/model
      2. Is there a seeded applet-specific renderer/model
      3. Is there a custom default renderer/model
      4. Is there a seeded default renderer/model

      Regards,

      Jeroen

  6. Hi Jeroen,

    It worked liked a charm.
    But we are also getting issue loading Dispatch Board view.

    I believe it is similar issue mentioned by Duncan.
    Will really appreciate if you have already found resolution for it.

    Thanks,
    Atul

    • Atul,

      You need to watch out with global overrides. For those applets which have a seeded PR, the new custom global override PR will destroy standard functionality.

      This will change in near future (patch set) and IP16, where order of evaluation will be changed such that applets having seeded PM or PR will prevail, and in those cases custom PM/PR will not be loaded.

      Jeroen

  7. hey Jeroen,
    I tried to follow the steps that you wrote here, but it doesn’t work for me (I have ip15).
    can you please tell me what do I need to write under the DEFAULT LIST APPLET? I added under Object Expression Theme Aurora, but I don’t know what files I should chose.
    also, In the devloper tools I can see the DefaultPopupListDblClickRendererPR.js file, and it load, but it runs until the line:
    DefaultPopupListDblClickRendererPR.prototype.BindEvents = function () {
    and doesn’t go inside the function,
    it goes to line:
    return DefaultPopupListDblClickRendererPR;

    hope you can help me,

    Thank you,
    Tal

Leave a comment