Siebel Escript : Best Practices
1. Avoid Scripting for frequently fired events like changerecord which is fired every time a user navigates from one record to another. Scripting on such events can slow down the navigation.
Another such example is PreGetFieldValue which is triggered for every single value retrieved from every column of dataset.
2. Try writing scripts in business services, as writing scripts on applet level can lead to a large amount of duplicated code (for e.g. in case of toggle applets).
3. When you use ExecuteQuery() function in the script, it uses the default cursor mode as ForwardBackward, so if you have a lengthy code and you don’t want backward navigation in records, you can use ForwardOnly mode which will save a lot of resources and result in faster execution of script. E.g. ExecuteQuery(ForwardOnly).
4. Comment your script to brief the functionality, because it becomes difficult for others to change or troubleshoot when you write a big chunk of code with no comments.
5. Correct use of scripts:
Browser script is recommended for:
-Communication with the user. e.g. Confirming an action.
-Interaction with desktop applications like MSExcel.
-Data validation and manipulation limited to the current record.
Server script is recommended for:
-Query, insert, update, and delete operations.
-Access to data beyond the current record.
6. Nullify your object references at the end of your script as they use some memory which should be released. Best location to do this is in the finally block which gets executed no matter your script completes or not.