In this post we are going to discuss few best practices that we should follow while writing eScript. I don’t know who the author of this text is but would like say thanks to that guy for sharing these tips with us, I found it in an newsletter and thought of sharing it with all you guys.
Tip 1:
Avoid repeated calling of a function if the results returned are the same. Instead cache the value in a variable. Especially avoid repeated calling of the API function like TheApplication ().ActiveViewName() as shown below
Usual Practice :
if (TheApplication().ActiveViewName() == “View1” ||
TheApplication ().ActiveViewName () == “View2” ||
TheApplication ().ActiveViewName () == “View3”)
Best Practice:
var viewname = TheApplication().ActiveViewName();
if (viewname == “View1” || viewname == “View2” || viewname == “View3” )
Tip 2:
Delay Object Instantiation. If the object being used is under a conditional expression then wait till the conditional statement actually evaluates true. This reduces the cost and burden on the server. See the code below.
Usual Practice:
var BO = TheApplication().BusObject(“Contact”)
var BC = BO.GetBusComp(“Contact”)
if (status == “Pending”)
{
BC.SetSearchSpec(“Id”,’12323’)
BC.SetSearchSpec(“Status”,”Pending”)
}
Best Practice:
if (status == “Pending”)
{
var BO = TheApplication().BusObject(“Contact”)
var BC = BO.GetBusComp(“Contact”)
BC.SetSearchSpec(“Id”,’12323’)
BC.SetSearchSpec(“Status”,”Pending”)
}
Tip 3:
Use SetSearchSpec only on Indexed column. Before we do ExecuteQuery in the script, we use SetSearchSpec to retrieve only relevant records. SetSearchSpec also limits the number of records retrieved which makes the ExecuteQuery faster. But on what type of column we do SetSearchSpec on is also very important. We should always do a SetSearchSpec on indexed column so that the records are retrieved very fast. This saves a lot of burden and time on both application and database servers.
Tip 4:
When we use ExecuteQuery, we need not do execute query again on child BC. ExecuteQuery on parent BC also forces a query on all active child BC defined using Links. For example in the screenshot below, consider Account Object. There is Link defined between Account and Action BC. So if a query is executed on Account BC, only relevant Activity records pertaining to the records Account BC are retrieved. This behavior is very similar to searching in the Siebel application UI where if you have Account –Action view and if you query on Account applet, only activities relevant to are shown in the bottom list applet.


(7 votes, average: 3.29 out of 5)
14 Comments at "Siebel eScript – Best Practices."
Hai
the above best scripts really very good can u plz post some more scripts(give me more no of TIPS)
Thanks & Reagrds
Eashy
I am surprised to see this post here. It came from this link
http://siebelguide.com/siebelblogs/2007/12/03/escripting-best-practices-part2/
Hi Sowmya,
As I had mentioned in the start of the post that I don’t know who is the author of post.
Now that you have pointed out who is the author I will link the post to the orignal post.
Hi,
I have one requirement like I need send a File Attachment from Siebel To Portal Application
In Integration.
If any body having idea please post as soon as possible
Thanks & Regards
Basha
I want to add something for the tip #2 where we are conditionaly instatiating the BO’s & BC’s.If this is the case, we need to nullfy them also conditionaly. Some people by default nullify all the objects insantiated.If we try to nullfy something, which dosen’t exists in the first place, it will error out.
(we make this mistake unknowingly).
Hope it will be useful.
I found a more elegant solution to your first example:
//you can declare this at the declaration file so you always find you definitions at one place
var aViewName = ["View1”,“View2”,“View3”]; at the
//to check whether the current view matches the target list
if (aViewName.IsIn(TheApplication().ActiveViewName()) {
}
I also found a better solution to your second example:
//Get me the contact’s last name by passing you the unique row id
var sLastName = TheApp.Get(”Contact”).GetFieldValueWithId(”12323″,”Last Name”);
//Get me the contact’s last name, first name and birth date in an array form by passing you the unique row id
var aInfo = TheApp.Get(”Contact”).GetFieldValueWithId(”12323″,["Last Name","First Name","Birth Date"]);
//Get me the contact’s last name, first name and birth date in an array form for those records which have the status of Pending
if (TheApp.Get(”Contact”).QueryWithSearchExpr(”[Status]=’Pending’”))
TheApp.Get(”Contact”).GetFieldValue(["Last Name","First Name","Birth Date"]);
I didn’t innovate any of the examples above. They are just the fraction examples I copied from the current running application. Why do I bother declaration of Business Object and Component everytiume I access its service?
Paolo, your examples didn’t reveal the whole picture. The scripts are based on ATI framework. Simply copying the posted scripts won’t work and it may mislead the audience here. It is best to get trained before using framework. BTW is it a telecom project?
Hi Tiziana,
When I read the internal documentation, it stated ABS Framework rather than ATI. Early last year We had a major overhaul on workflows and processes, all scripts were reworked using the ABS (ATI?) Framework, the results are can be summed up one word - Superd. My only complain is its lack of documentation, even the Siebel Expert Service has little knowledge about it. If you know something about it, can you shed some light on this?
Yah, it is a telco project at Milan.
I can see why you saw “ABS” somewhere in the scripts. Amazing bought this framework from an independant consultant and changed it to “ATI” which got aligned with the company name. Since this framework was created by individuals, you won’t find it from bookshelf. I was fortunate enough to attend the training last year, I never knew escript can be scripted this way. I considered myself a good programmer before training. I then realized what I knew about escript is only kindergarten in the training. The good thing is I became a total framework thinker after the training. This is my personal experience from architect’s point of view.
Since you mentioned telco at Milan, I used to work there in 2006 but I don’t think I met you before. How was your experience with ” ABS”?
This is really intersting and eye opening converstaion here guys.
I never thought that we could have a scripting framework in Siebel but now when I read what you guys are saying I am thinking
Why Not???
It would be really great if you guys could put some more light on this framework may a small article explaining the basics which we can share with everybody.
Still a very valueable information though. Thanks for sharing
Thanks for Neel’s encouragement. Being a Siebel veteran of 10 years, supporting Siebel application is a thing of business as usual until I got knew to ABS Framework. Let see how it changed the way I managed Siebel application and its support:
- We used to have 120K lines of scripts in Siebel application. The old Siebel ES review said it was bad and got to be reduced half of it. The ES never explicitly said HOW to do it, and no one think it is even possible. The system integrator took the case seriously and gathered a team to re-engineer the whole scripts using the ATI Framework (what they called it, or ABS on the documentation). Finanlly all scripts were reduced to 10K of lines in 8 Business Services. What it meant is the core business logic of our entire telco OSS was shrunk to 8 BS. This is truly a miracle!
- Initially ES didn’t dare to review the final work as they didn’t understand any of it. Finally they seeked advise from their Orcale Siebel Engineering Team from California. Their reply is simple and powerful - Perfect. Informally the Siebel engineers said the work is a piece of art. I didn’t take it literally until I learned more about it later.
- I believed no one can instantly ever tell the number of business processes in their Siebel application. Well, not only I can tell exactly how many of them(it is 124), but how they related to each other. Are they important? Yes, absolutely yes. When a change or a new requirement came, I will always know where to “tweak” in Framework with the less time and minimal effort. For example, an approval process required certain changes in position and status in the loop. Accenxxxx quoted us 30 days of work. Eventually we did it ourselves and pulled it off in less than one hour in which SRF compilation occupies 30 min. I hope things like that happen more often, so I can get my promotion quickly ;-)
- The logging function of ABS Framework is my favorite feature. The logging level and location can be set at System Preferences. There is one special feature called instantaneous logging that kept the support team informed of the errors even before it was lodged by the front desk. Imagine a Siebel user encountered an error and she may spend time to lodge the error with the description and captured screenshot using another application (Mostly they didn’t do it and left bad data in application). This action is no longer needed or critical for our troubleshooting. In the event of Siebel error happened, the error itself was captured on a file (created and written by Framework) with all the necessary information needed for troubleshooting. The rectification is almost instant with immediate feedback. There is something special about the logging format that makes troubleshooting very much easier. Probably Tiziano can shed some light.
- Before the rework, we used to have at least 2 traffic spikes within a day. When a spike happened, we see both CPU and memory’s utilization quickly eat up the Sun servers. Sometimes we have to restart the server cluster on a daily basis. After the rework with ABS, we never see spike happening and the shutdown was back on weekly basis as normal. This has something to do with the framework that always reuses a single copy of business object and component consistently throughout the same session. That’s why it never stress out the Siebel garbage collection that cause the spikes and instability. Tiazano, correct me if I am wrong.
Full understanding is vital to make the best use of ABS. Sadly to say I don’t understand it fully still. I know how to use it mostly but I don’t know why it is done that way. I am not qualified to start a thread to discuss ABS know-hows. Perhaps someone out there can enlighten all of us.
[...] started as a simple post for sharing few best practices that turned out to be an eye opening post mainly due to contribution of Paolo and Tiziano by way of [...]
Hi Tiziano and paolo, can you comment on the performance of this framework? And I can not find anything related to this on google. Please tell us where we can get any documentation or installables?
it would be really great if get any more information on ABS framework.. thanks in anticipation.
Paolo, I work for Oracle Siebel Expert Services in Milan, and I’ve never heard of the ABS/ATI Framework.
Can you shed some light?
Comment Now!