8/02/2010

Scripting

                Hello everyone. Today I will try to explain about scripting in Siebel. Scripting is widely used method of requirement implementation in Siebel, but in the same time it is not best practice or best choice.

                So all in all writing a script means writing a bulk of code to do some functionality. There are two scripting languages that Siebel developers use – eScript and VBScript. Most widely used is eScript, but in internet you will find many people that use VB. I will talk about eScript because it is what I use in my job.

                To write a script with eScript we can use similar syntax as JAVA, C++, and C #. Of course to do scripting you need knowledge of programming. We can use scripts on objects like Applets, Business Components, and Business Service. There are two types of scripting – Server Script and Browser Script. This means two ways of result:

1)      Server Script – it works on server side and do your code flow like normal program that you write in code. For example you coded the code on Applet for your custom button that inserts default data in new record depending on user’s responsibility. When user click button server checks his responsibility and enters default data depending on responsibility.

2)      Browser Script – they work on browser side. This type of scripts usually is real pain and developers try to not use them, but sometimes there are no other choices than use browser script. With browser script you can get confirmation windows like “Do you want to proceed? Yes! No!” Browser scripts is only way to do this, but they are really hard to write and test because you can’t debug them. Also every time you compile it, it generates browser scripts and you need to follow what scripts you generated earlier and what only now.

Ok let’s do some scripting now. I will not talk about syntax because I assume that who reads this know how to program. If you want write a script you need to find object in Siebel Tools and right click it with mouse and find “Edit Browser Scripts” or “Edit Server Scripts” depending on what script type you want to write. After that opens scripting windows! In left side you will see tree with some methods! Those are Siebel standard methods for this objet. Like for Applet:

1)      PreInvokeMethod;

2)      InvokeMethod;

3)      ShowControl;

4)      ShowListColumn;

5)      PreCanInvokeMethod;

6)      Load

As you already see, those are events on witch you can put code. That means if something happens with Applet then the appropriate code will be called. For example you create a custom button, put it on Applet and give it an Invoke Method property – EventMethodLaunch. Then in InvokeMethod event (some times in PreInvokeMethod or PreCanInvokeMethod, depends on what you are coding) you write:

if (MethodName == “EventMethodLaunch”)
{
                Do something;
}

No comments:

Post a Comment