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.

 



March 12, 2015

100 Siebel Interview Questions : Workflows : Part 2

On readers interest, creating Part 2 for the post on Siebel Workflow Interview Question, feel free to leave a comment for any specific question that you faced difficulty in answering or would like to know more about any specific area in Siebel.



Question: Is it mandatory to specify Business Object on a Workflow?

Answer: No, Business Object needs to specified only when there is need to use Siebel Operation in Workflow.

Question: What is the difference between Expression business component and Filter business component in Siebel Operation?

Answer: These business components fields are used in Siebel Operation when search spec is built by referencing another business component field.

For Example: To find Account records where Account Id is specified in Contact's Account Id field, expression will be created like :
"[Id] = [Account Id]"
And Filter Business Component will be set as : Account and Expression Business will be set as Contact. Thus it will be evaluated as :

"[Account.Id] = [Contact.Account Id]"

read more on :
How to create Siebel Operation Expression 
Bookshelf: Defining Siebel Operation Search Spec


Question : How to compare two properties in Siebel Workflow?

Answer: Expression on Siebel Conditional branch can be used to compare two properties.  To see how to create expression in siebel workflow please see.



March 10, 2015

How to invoke siebel workflow through Command Line?

Siebel provides very simple way of handling this situation via server manager. Server manager is command line interface of Siebel which primarily designed to perform system administration activities like starting and stopping components, it can also be used create requests for the server components.

To execute a siebel workfow through command line first we need to connect to the server manager through this command:

srvrmgr /g gateway1 /e enterprise1 /s server1 /u sadmin /p pwd

 And then execute following command

run task for component WfProcMgr with processname='Test Workflow'

You additionally pass SearchSpec and use workflow process batch manager to execute workflow for multiple records.

run task for component WfProcBatchMgr with processname='Test Workflow', SearchSpec ='[Date]=Today()-1'  

This solution has only two limitations,  

First, we can not pass values for process properties of the workflow. This has to be done by querying the values first and then calling the actual workflow.

Second, if the batch size is huge it might take few hours to serveral hours to process depending upon the workflow process. This happens because Workflow Process Batch Manager executes the workflow in sequence. That means it will only start the workflow for second record when first is finished.

Please share your experiences with Batch processes designed through command line.