February 18, 2016

Siebel Open UI Interview Questions plus bonus jQuery tips

Question 1 : What are different layers of JavaScript classes in Open UI ?

Answer: Siebel Open UI framework provider 4 different type of js files , proxy, presentation model(PM), physical renderer(PM), and plugin wrapper(PW). Out of these only PM, PR and PW are recommended to modify and extend. Proxy is an interface between Siebel server and browser, thus should never be changed.

Siebel Open UI Architecture

Read more

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.

February 04, 2016

Chrome's hidden menu for Open UI

If you are working on css or js changes for Siebel Open UI, you would be struggling with browser caching. I have noticed some cache even when I am using incognito mode of chrome.

Out of frustration one might end up installing chrome app/plugin to forcefully clear cache. One of them is "Clear Cache" 

Interestingly chrome has now created a very discreet "Empty Cache and Hard Reload" option for developers. To see this option open developer tools by pressing F12 and then press and hold reload button. I have been using this option from past one week and it worked every time as expected.

Chrome Hard Reload for Open UI


Please be mindful that this is an hidden menu and only shows up when chrome's developer tools are open.


Happy coding :)

January 23, 2016

My top 5 Siebel Mistakes in 2015

I received a very candid email from a reader, asking me what mistakes I make in Siebel development and how do I overcome those?

Surprisingly I had a long list of mistakes, and I wasn't doing anything about it. So I decided to write this post to attempt on reducing these mistakes.




I believe in learning from mistakes, thus I challenge all my readers to list down their mistakes and leave them in comments below. Remember no one is perfect, so don't be shy and leave comment.

1. Using InvokeServiceMethod in calculated fields.


This is biggest performance degrader.I regret this one the most, I used this trick to calculate an status of opportunity and it turned out to be biggest technical debt of all time. No one want to fix it now and it is stuck there churning away time, memory and CPU every time it is referred.

2. Not checking CountRecords() Or FirstRecord() before get field value.

This is one of my most frequent mistake in Siebel. It goes unnoticed because the logic works for mostly all scenarios but one, what if there are no records retrieved from query? Siebel is going to throw it back to you, logic won't proceed and service will halt making you accountable.

So please don't be a Jim and always check for record count or First Record before proceeding.


3. No comments

Leaving no comments on blog post is ok, but leaving no comments in script is a big no no. Have your ever noticed how much easy it becomes if there is one of two line of comments in script? just one or two line makes it so convenient for developer to understand the code without going into details.

My self plead guilty of committing this some time.

If I have to create a standard I will try to use following template for comments:

/*
[jim] [25 Dec 2015] [ added code for xxxxx reason, code is invoked from xxxxx places]
*/

simple isn't it? Please share in comments below what type of comments you use.

3. Not nullifying objects after use.

Developers believe that ST script engine will clear up memory for them. But no memory leaks are real still in Siebel 8. So please Jim don't make that mistake again.

4. Try catch finally block
This is the only way for keeping some dignity, and we still avoid it to save time.  Do you also make that mistake?

5.  Using profile attributes.


They work like magic in some scenarios, but it is so difficult to trace them back, and using it in Open UI is like calling Mayhem. Please share your thoughts on this. How do you trace back the creation of profile attributes?

Please don't forget to leave your list of mistakes in comment below.

January 16, 2016

How to get name of siebel server in eScript?

I found this script recently on support web which allows us to get value of Siebel server name, log directory of the current session. I quickly extended script to get value of siebel task id and process id to help me in my debugging.

These values can be very useful if you are working on multi server issue. With the help of task Id I was able to find the log of current session without opening each log file. Please share in comments below on how you choose to use this script.

var serverSession_BO = TheApplication().GetBusObject("Server Admin - Sessions");
var serverSession_BC = serverSession_BO.GetBusComp("SA-VBC Session");
var taskParam_BC = serverSession_BO.GetBusComp("Server Task Parameter");

serverSession_BC.ClearToQuery();
serverSession_BC.SetSearchSpec("OM_LOGIN", logInName);
serverSession_BC.ExecuteQuery(1);
serverSession_BC.FirstRecord();

taskParam_BC.ClearToQuery();
taskParam_BC.SetSearchSpec("Parameter", "Log directory");
taskParam_BC.ExecuteQuery(1);
taskParam_BC.FirstRecord();


var compName = serverSession_BC.GetFieldValue("CC_ALIAS");
var siebsrvrName = serverSession_BC.GetFieldValue("SV_NAME");
var task_id = serverSession_BC.GetFieldValue("TK_TASKID");
var p_id = serverSession_BC.GetFieldValue("TK_PID");
var logDir = taskParam_BC.GetFieldValue("Current Value");


Additionally one can also find the windows process id and thread id by using following script.

var processId, taskId;
processId = taskId = ""; // initialize to satisfy eScript parser

//evaluate to suppress STDCALL not being recognized with eScript parser
eval('processId = SElib.dynamicLink("kernel32.dll","GetCurrentProcessId", STDCALL)');
eval('taskId = SElib.dynamicLink("kernel32.dll","GetCurrentThreadId", STDCALL)');

processId = processId.toString();
taskId = taskId.toString();

I bet you wont be able to do this in any cloud application. :)

Hope it helps. 

November 13, 2015

Let's Slack

Have you noticed declining activity on siebel community on IT Toolbox? There is hardly any other community where you can get your answers quickly.

And as a wise man has said All work and no play makes Jack a dull boy, I am starting a new Siebel-Developers community on slack. http://siebel-developers.slack.com
Slack is fastest growing community platform, there is no bullshit for email or waiting for approval. Simply talk to fellow team-mates straight away. Share ideas, make new connections and have fun with fellow siebelites.



Share files and get help in real time.

you can access community from mobile or desktop.




Only drawback of the platform is that invite has to go on email address, so please register to this blog to get invite. I have sent invite to all registered readers till date, hope to see you all there.

Let's Slack Siebel :)

November 10, 2015

What are the limitations of Siebel Workflows?

This question was asked by one of readers of this blog, and it quickly got me intrigued to research for answer. While doing research I compared the capabilities of Siebel workflow vs Siebel scripting, and got amazed with results.




I started of by listing things which I thought wont be possible in workflows however I got surprised with its capabilities as I dig deeper. I am classifying results as Myths, Facts and Limitations.

Myths

Myth 1: Run time events doesn't work from workflows.

Absolutely wrong, runtime events are tagged to bus comps and work the same in workflow as they work on UI.

Myth 2: Can't update read-only fields in workflows.

One might think that as it is not possible to set admin mode to true in workflow thus it wont be possible to update read only fields. But that is simply a myth.The fact is that there is no need to set admin mode to true in workflows, read only user properties are inactivated for workflows all the time!

Myth 3: There is no way to associate and disassociate records of MVG BusComp in workflows.

If Siebel operation is used on detail bus comp, delete operation acts like dis-associate and insert like an associate.

Myth 4: Workflow can not query based on calculated fields.

Not True. Siebel Operation search spec can be created using Calculated fields, however be cautious of performance impact in case you plan to use calculated fields in search spec.

Facts


Fact 1: Cannot query on child BC directly in Siebel workflows. Workflow always queries Primary bus comp first.

True, however I don't consider it as limitation as one can create workflow based on a different BO which has child bus comp as primary buscomp, and there are many business services available which can query data from another BO without creating another sub process.

Fact 2: There is no way to change primary record in MVG in workflows.

This one I am not too sure about, would like to know from the experts, how they have overcome this problem.

Limitations


Limitation 1: It is not possible to change view mode in Workflows?
Siebel Operation step always queries database with "All View" view mode there is no way to change this pragmatically.


Limitation 2: It is not possible to pass variable by reference in to a workflow.
This seems to be the minor limitation of the workflow, however it does not limit the capability or usage in anyway.


Limitation 3: There is no native way of executing Clib functions in workflows.
There are lot of functions available for execution in workflows however Clib is not one of them. Thus if there is a need to call Clib function through workflow you will have to call a custom business service.


Limitation 4: There no native way to execute methods on application or BC level.
Agreed as limitation unless someone suggests any way out. Some BusComps exposes some methods that can be executed only with scripting. For Example: 1. RepriceAll Method on Quote Item and Order Items. 2. GetFile Methods on Attachment Buscomp etc..

 

Limitation 5: It is not possible to set sort spec on Siebel operation?
This seems to be the only glaring Limitation of workflow/Siebel Operation that Siebel operation does not contain any way to query based in a sort spec. Arguably one can say sort spec can be specified on bus comp, however it wont be wise to clone buscomp just to change the sort order. Would like to know what readers think?



I don't believe that this list is complete in anyway, hoping to get some answers from community. Please feel free to contribute your thoughts on this topic, would be more than happy to be proved incorrect on the points above.

October 25, 2015

Download Siebel Interview Questions - PDF

I have published all the Siebel Interview Questions in a easy to read PDF e-book  format, it will be available for download freely.

To get the download link, register your email and leave a comment below.
Siebel Interview Question eBook


Siebel Interview Question 2015 PDF  Contains interview questions on :

Siebel Workflow
Siebel EAI
Siebel Configuration
Siebel Scripting
Siebel Open UI

Updates to PDF will only be sent to registered readers. After registering with email do not forget to leave comment below and plus one on google to receive the link.

Get Download link:



October 24, 2015

Links Demystified

I feel no shame in admitting that it took me years to fully understand the extensibility of Siebel links. I hope after reading this post you will start appreciating the Siebel even more as I did.

Let's look at the simpler links first.

1:M links
These links creates simple parent child relationship. One parent can have many children. And children records have parent id (foreign key field).


Order Entry - Orders : Order Entry - Line Items link

Order Entry - Orders and Order Entry - Line Items is perfect example. Source Field is "Id" of "Order Entry - Orders" BC and destination field is "Order Id"  of Order Entry - Line Items. Whenever system creates a line item under an order record, Siebel populates order id on order item record with ROW_ID of Order to create relationship.



M:M links
These are also comparatively simple links. Two entities (table) are related to each other using an intersection table. Intersection table helps to associate one child to other parents as well.

Account Contact link using S_PARTY_PER


For example Account and Contact link. This link allows to associate one contact to multiple accounts. In addition to the inter table Siebel stores id of primary record ( primary id field) to improve performance.

Now let's look at the interesting bits.

M:M links with source id field specified.

In standard M:M links these fields are blank and inter table stores the ID of both parent and child records. When parent id field is also specified with inter table Siebel uses field value instead of ROW_ID of parent to create intersection record.These types of links are not very common but are possible.

For Example:
M:M link with Source Field specified





Lets consider Action/FINCORP Account link, this link has Source Field specified as Primary Contact Id which means when child records are created using this link Siebel will populate Contact Id into Inter Parent Column instead of Action Id.

M:M link with both inter table and source and destination field specified.
Things now gets more interesting when both source and destination fields are specified and inter table is also specified.This way Siebel uses fields specified on the links instead of Id to create association.

Link with both Source Field and Destination Field along with inter table.
The link shown above specifies Campain Id and Destiation Field as Contact Id, thus while creating record in inter table Siebel will use Campaign Id fields instead of Id and Same applies for destination field. Interesting isn’t it???



Finally links which are overridden by MVL's
If you are following it correctly then you might think all these complicated links should be able to satisfy all possible scenarios. Just then Siebel steps up the game with multi value links. On these MVL's definition Siebel allows to override the parent id being used on the link.

So with help of primary id field override, potentially in action to contact mvl instead listing all the contacts of selected activity, Siebel can show all the contacts of parent account selected on activity. :) This over riding is allowed both on 1:M link and M:M link.


Cheat sheet for your desk:





If you have understood all of the above then I would recommend you to explore how links are used for access control and visibility of detail bus comps.

Hope it helps.

October 09, 2015

Using MVG aggregate functions

Originally posted on blog.notesonsiebel.com on April 5th, 2007 by stuandgravy

Karan asked a question the other day: how to prevent the Status of a Service Request changing until all child Activities have been completed? This type of business rule is exactly what State Models are designed for: set up a model on Service Request Status and restrict transitions to the target status unless a condition has been satisfied. The difficulty in this example is how to write a rule based on child records?

State Model Rule Expressions use the same format as calculated field values, so the same MVG aggregate functions are available. The functions Count, Sum and EXISTS all derive a single value from a Multi Value Group and are an underused way to reduce scripting.

In the example given, Service Request has an MVG Action linked to the child Activities, so we can add a Multi Value Field to point to Action.Status.

A rule expression Not EXISTS([Action Status]<>'Done') in the State Model transition gives the desired restriction.

There’s a good example of the EXISTS function in use in the vanilla Siebel 7 repository: see BC Contact field Exists New OutBound Email Activities.