March 18, 2015

Siebel Interview Questions : Scripting

See collection of Date functions in Siebel eScript

Siebel Scripting is one the most interesting areas of Siebel, if it is done properly it can do wonders for business, otherwise it can lead to ever increasing technical debt.

Siebel Tools Scripting IDE

Before jumping to questions let us look at some lessor known facts of Siebel Scripting:
  1. Siebel support two scripting languages: eScript and VBScript
  2. Full name of eScript is ECMA script which developed further to become javascript. 
  3. Garbage collection of Siebel scripts in not automatic
  4. Siebel eScript does support prototype overriding and classes
  5. Siebel eScript can pass arguments by value and pass by reference

Question: Which Siebel objects supports scripting?

Answer: Script can be written on following objects in Siebel:
  1. Business Services
  2. Client Side Business Services
  3. Business Components
  4. Applets
  5. Application
  6. Product Configurator Events
  7. Smart Scripts
  8. Workflows (via business services)
  9. Open UI js class files
  10. Browser scripts on Applets, BusComps, Application, Business Services
  11. Siebel Webtemplates SWTs
  12. ?????

Question : How to change primary record of MVG using scripting?

Answer: Primary record of MVG can be changed by setting the SSA Primary Field of the associated record. 

Script could look like:  
        bcOpty.ClearToQuery();
        bcOpty.ExecuteQuery();
        if(bcOpty.FirstRecord())
        {
            var bcMVG = bcOpty.GetMVGBusComp("MVF Name");
           bcMVG.ActivateField("SSA Primary Field");
            bcMVG.ClearToQuery();
            bcMVG.SetViewMode(AllView);
            bcMVG.SetSearchSpec("Id", "1-12345");
            bcMVG.ExecuteQuery();
             if(bcMVG.FirstRecord())
            {
               bcMVG.SetFieldValue("SSA Primary Field", "Y");
               bcOpty.WriteRecord();
            }
        }

Question : How to set pick list field using script?

Answer:  GetPicklistBusComp() Pick() methods are available in eScript by which system can search on pick list buscomp and pick desired record.

Syntax for pick method can look like:
oPickBusComp = buscomp.GetPickListBusComp("FieldName");
oPickBusComp.ClearToQuery();
oPickBusComp.SetSearchSpec("Id","12345");
oPickBusComp.ExecuteQuery();
oPickBusComp.Pick();
buscomp.WriteRecord();

Question : How to show a confirmation(Ok/Cancel) dialogue box in Siebel?

Answer: Confirmation Dialog box should be implemented through browser script using javascript confirm method. This method prompts users with option to proceed or cancel the process.



Click here for example.



Question : How to call batch file through scripting?

Answer: Siebel provides C libraries to access the host of Siebel server.
Clib.system() is one of those functions which allows script to pass some instructions to command processor of server host.
Using this method, a batch file can be invoked from Siebel which can do OS level changes.
Following instruction can execute Siebel.bat file on the server:

Clib.system("C:\\Scripts\\Batch\\Siebel.bat");

Question : How to update read only fields in Siebel?

Answer: Fields in Siebel are configured as read-only using "Field Read Only Field" and "BC Read Only Field" user properties. These user properties does not work on views where admin mode flag is set to Y.

BusComp.InvokeMethod("SetAdminMode", flag)

Question: What is the difference between SetAdminMode and SetViewMode(AllView)?

Answer :
  • SetAdminMode mimics the behaviour of Admin Views, and is used to update read only fields
  • SetViewMode instruction changes the default view mode of the business component, it used to access records which are not visible with default view mode.


Question : Is it possible to invoke workflow through browser script?

Answer: Workflow can be invoked through browser script if "Workflow Process Manager" declared as Client side business service in Application's User Property. 


Question : What type of error handling is available in Siebel eScript?

Answer: try catch finally instructions helps to handle run time errors in e-script.

  • try block marks the code which needs to handled
  • catch block declares commands which should be executed in case of error,
  • finally block is executed after try and catch has completed executing.

try
{
   statement_block
}
catch
{
   exception_handling_block
   [throw exception]
}
finally
{
   statement_block_2
}

Finally block is always executed no matter if there was error encountered or not.

Question: How to get language of Object Manager?

var lang = TheApplication().InvokeMethod("LANGUAGE");

Question :  What is difference between ActiveBusObject() and GetBusObject() methods?

Answer: ActiveBusObject is mostly used in UI based scripting requirements, this method can only return the handle of current BO instance.

For example: In Accounts screen ActiveBusObject will return Account BO and subsequent .GetBusComp().GetFieldValue will return the information from the record selected by user.

Same script in Contact Screen will return the Contact BO.

Important Points about ActiveBusObject: 
- It is not recomended to use ClearToQuery and ExecuteQuery on BC of ActiveBusObject as UI context for user will get lost.
- ActiveBusObject is the only way to get BO in browser script.

GetBusObject method should be used when current BO instance does not have the BC of interest. We can get handle of any BO in application using GetBusObject This is mostly used in background processes and workflows.

 



1 comment :

  1. how to create a custom field in siebel tools?

    ReplyDelete