February 06, 2016

JavaScript Execution Sequence of Siebel Open UI

Hope everyone remembers Siebel event model explained by +Alexander Hansal 
No doubt that is one the best post in Siebel blogosphere till date, in case you haven't read it, I would recommend you to go through it here. This model still holds true and has helped many businesses to model processes. However with introduction of Siebel Open UI there are few more events available for customization on browser side. 

In this post I will show you how Open UI invoke different events and methods on custom PM and PR JavaScript files.

For this proof of concept I have created and associated PM PR files with some logging for all the applets and views. I have also wrote some browser script in applet load event in tools. Following summarizes what I found.

Sequence of JavaScript Execution in Open UI

What I found out that view PM layer is the first in sequence of execution, it is executed even before preload event. Thus all the data is available in preload to build the UI. Preload.js is not the event if someone is looking to execute at very start of view building.

Sequence of execution breakdown
Breakdown of events shows that List applet are executed first by Siebel Open UI (even if they are child objects). I suspect it is done to improve performance.

Additionally Applet load event are executed at last. Thus technically it is possible to override events available in "pre" Open UI era browser scripts in Open UI.

Points to be noted here that:

  1. Prelaod.js is not the first thing which gets executed during a view load.
  2. Open UI executed PM layer for view first and then applets, however for PR layer, applets were loaded first then view.
  3. Open UI also seems to execute list applet code first than form applet irrespective of hierarchy in tools!!
  4. After all the processing of PM PR layers(including view), Siebel at last executes applet load event of tools browser script.
Console Outputs:

Hope this will help developers to know the correct event they need to code and execution sequence in which Siebel will execute the code.

For this experiment I have created following PM / PR files .
  • OpportunityFormAppletPM
  • OpportunityFormAppletPR
  • OpporunityContactListAppletPM
  • OpportunityContactListAppletPR
  • OpportunityDetailContactViewPM
  • OpporuntiyDetailContactViewPR
  • OpportunityListViewPM
  • OpportunityListViewPR
  • OpportunityListAppletPM
  • OpportunityListAppletPR

All files I have used is available will be available for download soon.

Thanks to Duncan Ford for helping us in getting us code ready by creating the beautiful template generator.

Happy to discuss in detail on slack community or in comments below.