Professional Documents
Culture Documents
Siebel Scripting Interview Questions 2
Siebel Scripting Interview Questions 2
Variable in eScript?
9.What is the usage of Forward Backward And forward only contacts in search
methods ?
Ans :
ForwardBackward. Selected records can be processed from first to last or
from last to first. This is the default if no value is specified.
ForwardOnly. Selected records can be processed only from the first record
to the last record. Focus cannot return to a record.
10.What are some benefits of using declarative alternatives to scripting?
Ans:
Address common requirements as configurable options.
Has undergone performance testing.
Is easier to maintain and upgrade.
Avoids cost associated with scripting.
Scenario’s
Scenario : 1
i want One custom control On Applet Like " My Account " . Whenever I will click
that Control Button account based on the location it should display All Values
Solution:
Step 1: create One control in applet Level and set properties like method Invoke is " My
Account"
Step 2: compile ur srf and open ur application the button will appear in disable State .
step3 : now u have to enable the button for that purpose write a script in web
applet_PreCanInvoke Method event
{
if (method name == " My Account")
{
Can Invoke = "TRUE ";
return(cancel operation);
}
return ( Cancel Operation)
}
Step 4: now u want to diaplay locations based on accounts then write code in web applet
pre invoke method event
{
case "My Account":
return(Cancel Operation)
break;
}
return ( Continue Operation)
Scenario : 2
Solution:
Step 1: identify MVF in any BC and Call that MVF into script
Step 2: write A Code in BC Object and event is Bus Comp _ Pre Write Record Event
if (length == 0)
{
the application.RaiseErrorText ( "enter a Value")
}
return(Continue Operation)
}
Scenario 3:
if u Create one New Record in Account an Activity record should be create for that
Account
Solution :
write a code in BusComp_NewRecord Event
function BusComp_Newrecord( )
{
var oAction Bc;
var oAccount Bc;
var oAccount Bo;
NewRecord(New Before)
SetFieldValue("Type", "ToDo");
'' ("Display","Activities");
'' ("Account id","SAccount Row Id");
write Record( );
oAction Bc = null;
oAccount Bo = null
Scenario 4:
i want check the date filed in account Applet if it is more than today's date display
error message to the user ?
solution:
step1 : create One date Function Like "Check Date" in General in scripting . Because this
Function we can use any event of that particular object.
step2: write a code in General in serverside script
function CheckDate(sValue,sField)
{
try
{
var sdate;
var ddateofbirth;
var ndateMS;
var dtoday;
var ntodayMS;
var sreturn = 'N';
try
switch (FieldName)
var DATEMSG = "RAC: Invalid Date of birth entered. Date of birth cannot be post-
dated.”;
oApp = TheApplication();
rtnOldDate = CheckDate(FieldValue);
if (rtnOldDate == 'Y')
strReturn = CancelOperation;
throw(DATEMSG);
break;
catch(e)
}
final
scenario 6:
Need to create a button on “Contact Form Applet”, Name of the button is “Cross Sell”, when
you click on that button it should be pop up an window
Pop up Details: That Particular contact is eligible for Cross Sell the other bank products. It
should be based on Don’t Mail and Don’t Call fields.
Conditions:
If Don’t Mail is True and Don’t Call is False - Contact is eligible for selling Credit Card
If Don’t Mail is False and Don’t Call is True - Contact is eligible for selling Mutual Funds
If Don’t Mail is False and Don’t Call is False - Contact is eligible for selling All the Products
If Don’t Mail is True and Don’t Call is True - Contact is not eligible for selling the Products
The Above messages has to pop up based on the conditions when u clicked on the Cross Sell
Button
Solution
Configuration Steps
1. Create one control in applet Level and set properties like method Invoke is " Cross Sell”
2. Drag that Control in edit web Layout to control space
3. Compile Ur Srf (Once u will compile u will See only disable state Of control)
{
if (method name == "Cross Sell")
{
Can Invoke = "TRUE ";
return(Cancel operation);
}
return ( Continue Operation); // Modified Previously it is Cancel Operation //
}
Note : Now u can Visible the Cross Sell Button if u click That button it will throw some
error message for that u can write the logic what do u want when u click that button
var mes1 = “If house is rented and average income is above 1000 Jds offer
housing loan (not delinquent nor black listed, nor has any
returned cheques) “ ;
var mes2 = “If contact has any loan and is not delinquent nor blacklisted nor has
returned cheques due to insufficient balance and does not have a
credit card offer credit card” ;
var mes3 = “If contact does not own a car and income or salary transfer is
above 500 JDs offer a car loan(not delinquent nor black listed, nor
has any returned cheques)”;
var mes4 = “If contact does not have phone or internet or ATM offer the channels” ;
var mes5 = “If primary card and does not have secondary cards offer supplementary card (not
Delinquent nor black listed, nor has any returned cheques)” ;
var mes6 = “If internet banking offer internet banking credit card (not delinquent nor black listed,
nor has any returned cheques)” ;
var mes7 = “If he/she has a credit card from another bank offer our credit card (not delinquent
Nor black listed, nor has any returned cheques)” ;
var mes8 = “If he/she are a frequent flyer and does not have a credit card offer credit card (not
Delinquent nor black listed, nor has any returned cheques)” ;
{
else if (a == “Rented” && b > “1000” && c == “N” && d == “N” && e == “0”)
{
The Application.RaiseErrorText (“mes1”);
return(CancelOperation);
}
else if (f == “N” && g > “500” && h == “N” && c == “N” && d == “N” && e == “0”);
{
{
The Application.RaiseErrorText (“mes2”);
return(CancelOperation);
}
else if (i == “N”);
{
{
The Application.RaiseErrorText (“mes3”);
return(CancelOperation);
}
else if (m == “Null”);
{
{
The Application.RaiseErrorText (“mes4”);
return(CancelOperation);
}
else if (n == “N”);
{
{
The Application.RaiseErrorText (“mes5”);
return(CancelOperation);
}
else if (o == “Y” && c == “N” && d == “N” && e == “0”);
{
{
The Application.RaiseErrorText (“mes6”);
return(CancelOperation);
}
else if (p == “Y” && c == “N” && d == “N” && e == “0”);
{
{
The Application.RaiseErrorText (“mes7”);
return(CancelOperation);
}
else if (n == “Y” );
{
{
The Application.RaiseErrorText (“mes8”);
return(CancelOperation);
}
}
Scenario 7
How Can You Set a Multi-value Group Record as Primary Through Siebel eScript?
Solution
1. business component.
For further information and examples of all of Setting the primary record for a multi-
value group (MVG) is part of the base functionality in Siebel applications. This can be
configured to be set automatically through the Auto Primary property for a multi-value
link, or it can be directly selected by the user in the MVG applet.
A special field called SSA Primary Field is used in the Siebel application user interface
(UI) to allow users to view and modify the primary record in a MVG applet. The SSA
Primary Field belongs to the System category and is not visible in the Siebel Tools Object
Explorer or Object List Editor; however, it may be referenced as an applet list column in
MVG applets. You can set the SSA Primary Field through Siebel VB or eScript, as long
as it is defined in the MVG applet. This allows you to take advantage of the UI context to
mimic the end-user manipulation of the primary value in a MVG.
NOTE: Because this approach requires that a UI context be available, it is not available
through a COM Data Server interface or other interfaces which do not include a UI
context.
The following example outlines a suggested process, and the recommended methods to
use in order to set a child record as primary through Siebel VB or eScript:
Set SSA Primary Field to "Y" on the MVG these methods, refer to the following manuals
in Siebel Bookshelf version 7.7:
Siebel Object Interfaces Reference > Interfaces Reference > Business Component
Methods
Scenario 8
How Can You Display a Message from a Server Script on the Browser?
Ans:
Interactive dialog boxes are features that belong to the JavaScript language and can only
be launched from browser script. A server script cannot call functions written on the
browser side.
This solution will affect performance, especially on the browser side, so it is advised to
launch it only when necessary and stop when it is no longer needed. Additional notes
regarding this solution are in the Notes section following the example.
Example
The following example demonstrates a business service called ServerAlerts which checks
to see if an alert needs to be displayed, and if so, displays the alert to the user.
1. Create a new business service and add the following browser script to the
<general> <declarations> section:
2. General Declaration
3. var allowScanningServerAlerts = false;
4.
5. function ScanServerAlerts()
6. {
7. var message =
theApplication().GetProfileAttr("Alert");
8.
9. if(message != "")
10. {
11. alert(message);
12. theApplication().SetProfileAttr("Alert", "");
13. }
14.
15. if(allowScanningServerAlerts)
16. setTimeout("ScanServerAlerts()", 100);
17. }
18. Add the following browser script to the PreInvokeMethod of the business service:
var inPropSet =
theApplication().NewPropertySet();
var serverAlertsBS =
theApplication().GetService("ServerAlerts");
inPropSet.SetProperty("Value", "TRUE");
serverAlertsBS.InvokeMethod("AllowServerAlert
s", inPropSet);
var inPropSet =
theApplication().NewPropertySet();
var serverAlertsBS =
theApplication().GetService("ServerAlerts");
inPropSet.SetProperty("Value", "FALSE");
serverAlertsBS.InvokeMethod("AllowServerAlerts", inPropSet);
Scenario 9:
Ans:
If you have set up a view with manual toggle applets, there may be cases when you need
to toggle between applets as part of a script. This can be achieved by using the ToggleTo
method in the manner outlined below. Note that this technique should only be used if the
applet is set up for the user to manually toggle the applets. It should not be used to
execute a toggle when the applets are set up with dynamic toggle.
The following code should be added to the browser script. Usually it will go in the
Applet_PreInvokeMethod() event, but it could be placed in a different event depending
upon the specific requirements.
1. In the first line, a new property set object is created to pass the parameters
required by the ToggleTo method.
2. In the second line, the SWESeq parameter is set. It is required by the ToggleTo
method, and the value is the sequence number of the toggle applet expressed as a
string, for example, "1". To determine the sequence number for the desired applet,
look in Siebel Tools. Query for the main applet and then open the Object Explorer
to expose theApplet Toggle object. The Applet Toggle object contains a Sequence
Number property; this is the value to be used in the property set.
3. In the third line, the ToggleTo method is invoked with the property set.
Note that when applets are toggled, the entire view will reload. Therefore, it is not
recommended to use this method to toggle more than one applet at the same time, as it
might cause instability in the application.
For details on the ToggleTo method, refer to one of the following references, depending
upon your current version of Siebel eBusiness Applications:
Scenario 10
How Can I Add Hidden Fields to List Applet for Browser Script Access?
Ans:
Background:
Moreover, the ActivateField() method is NOT supported for browser script unless used as
part of a BC search, before ExecuteQuery and after ClearToQuery.
Solution:
2. The controls have to use the HTML Type: Hidden and must point to the required
field using the Field property.
Note: Do not set the 'Visible' property to FALSE. When the 'Visible' property is set to
FALSE, the field value will not load to the browser, hence the value is not available for
the browser script.
Related issue:
The above solution does not work for list applets, hence when a column is added to the
list it is visible to the end user regardless of the HTML Type defined. The end user can
also use the display column functionality to remove the column from the list. As result
the field is not available for the browser script.
Solution:
1. Create a control mapped to the field and set the HTML Type to Hidden.
The solution ensures that the hidden field values are available to the browser script but
are not visible to the end user.
This solution can be used in Form applets as well as list applets, avoiding having empty
spaces on the applet (where the hidden controls are added).
Scenario 11:
How can users use the GotoView method and maintain view context?
Ans:
The GotoView method can be used for navigating to different views from scripts. The
default behavior of GotoView is to place the cursor (focus) on the first record in the view.
When the script is required to get a specific record in focus the method can be executed
with business object parameter. The business object is then used to get a business
component (BC), on which a query is executed putting the required record in focus.
Example:
eScript:
// Get the Account business object
var AccountBO = TheApplication().GetBusObject("Account");
// Get the Account business component
var AccountBC = AccountBO.GetBusComp("Account");
with(AccountBC)
{
// Clear to query
ClearToQuery();
// Set the required search specification
SetSearchSpec("Id",TheRequiredAccountId);
// Execute query
ExecuteQuery();
}
// Call the GotoView Method with business object parameter.
TheApplication().GotoView(TheDestinationViewName,AccountBO);
Scenario 12:
How can users dynamically inactivate button when no records are displayed in
Siebel version 7.x?
Ans:
Parameter CanInvoke must return TRUE for the button to be enabled. Otherwise, it will
be disabled.
The following sample code is used to enable the button if there are records in the applet.
If no records are displayed, the button will be disabled.
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
if (MethodName == "My Method")
{
// Set Id field to string
var oBC = this.BusComp();
var sId = oBC.GetFieldValue("Id");
}
else
{
CanInvoke = "TRUE";
return (CancelOperation);
}
}
else
return (ContinueOperation);
Scenario 13:
Ans:
Siebel 7 has introduced a new field property "Immediate Post Changes" to post field
changes immediately to the server.
If "Immediate Post Changes" is set to TRUE, PreSetFieldValue event on the server will
be triggered.
If "Immediate Post Changes" is set to FALSE, only the PresetFieldValue event on the
Browser will be triggered.
For those fields with a dynamic picklist or multi value fields, PreSetFieldValue event
doest not trigger on the browser. This is the expected behavior. A Change request 12-
BF7ICN has been logged to include this information in the documentation. For these
cases, the code needs to be written on the server.
For those fields with static picklist PreSetFieldValue event will trigger on the server as
well as on the browser even if "Immediate Post Changes" is set to FALSE.
Scenario 14:
Ans:
Siebel applications provide multi-value group applets (MVG applets) to associate records
in many-to-many relationships.
By default, the MVG applets allow users to select multiple records at the same time to be
associated with the parent business component. There are occasions where users would
need to restrict this selection to a specific number. In those situations Siebel scripting can
be used to achieve this functionality.
Selected records are associated to the parent business component when user clicks the
“Add” button on the MVG applet. Script written in the Applet_PreInvoke method could
capture the “Add” action, count the number of records currently selected and abort the
“Add” action if this number is greater than expected.
The following eScript sample code limits the number of records than can be selected at
the same time on a MVG Applet to 1.