Siebel Interview Questions: Basic Scripting Examples

 

How to send emails using Siebel Scripting ?

 

//Using SendMessage 
var bsOutBound = TheApplication().GetService("Outbound Communications Manager");
var psInput = TheApplication().NewPropertySet();
var psOutput = TheApplication().NewPropertySet();

psInput.SetProperty("CommProfile","Default SMTP Profile");
psInput.SetProperty("ProcessMode","Remote");
psInput.SetProperty("MsgToList", <email string>);
psInput.SetProperty("MsgBody", <body string>);
psInput.SetProperty("MsgSubject", <subject string>);
bsOutBound.InvokeMethod("SendMessage", psInput, psOutput);

 

 

//Using CreateRequest 
var bs = TheApplication().GetService("Outbound Communications Manager"); 
var inputs = TheApplication().NewPropertySet();
var outputs = TheApplication().NewPropertySet();
inputs.SetProperty("PackageNameList","<Email Template Name>");
//inputs.SetProperty("TestAddress",mailid);
inputs.SetProperty("RecipientBusComp","<Buscomp>");
inputs.SetProperty("RequestLocaleCode","ENU");
inputs.SetProperty("RecipientGroup","<RecipientGroup>");
inputs.SetProperty("RequestLanguageCode","ENU");
inputs.SetProperty("SourceIdList",<Contact Id>);
bs.InvokeMethod("CreateRequest",inputs,outputs);

 

How to invoke workflow using Siebel scripting ?

var svc = TheApplication().GetService("Workflow Process Manager");
var psInput = TheApplication().NewPropertySet();
var psOutput = TheApplication().NewPropertySet();
psInput.SetProperty("ProcessName",<Workflow Name>);
psInput.SetProperty("Object Id", <Row Id>); //Else can give other parameters
svc.InvokeMethod("RunProcess", Input, Output);

 

How to add or remove records to/from MVG or Assoc Buscomp ?

var MvgBC = this.GetMVGBusComp(<MVG field name>); 
var AssocBC = MvgBC.GetAssocBusComp();
AssocBC.ClearToQuery();
AssocBC.SetSearchSpec(<Field Name>, <Value>);
AssocBC.ExecuteQuery();
if (AssocBC.FirstRecord())
{
MvgBC.ActivateField(<Field Name>);
MvgBC.SetSearchSpec(<Field Name>, <Value>);
MvgBC.ExecuteQuery();
var isRec = MvgBC.FirstRecord(); 
if(isRec == "")
{
vAssocBC.Associate(NewAfter);
}
}

Here is the example..

 

var boOpty = TheApplication().GetBusObject("Opportunity"); 
var bcOpty = boOpty.GetBusComp("Opportunity"); 
//To add record with name Rahul to MVG of Opty record RahulOpty
with(bcOpty) 
{ 
ClearToQuery(); 
SetViewMode(AllView); 
ActivateField("Oppty Name"); 
SetSearchSpec("Oppty Name","RahulOpty"); 
ExecuteQuery(); 
if (FirstRecord()) 
{ 
var MvgBC = GetMVGBusComp("Sales Rep"); 
var AssocBC = MvgBC.GetAssocBusComp(); 
AssocBC.ClearToQuery(); 
AssocBC.SetSearchSpec("Name","Rahul"); 
AssocBC.ExecuteQuery(); 
if (AssocBC.FirstRecord()) 
{ 
AssocBC.Associate(NewAfter); 
} 

//Making  Rahul Primay
MvgBC.ClearToQuery(); 
MvgBC.SetSearchSpec("Name","Rahul"); 
MvgBC.ExecuteQuery(); 
if (MvgBC.FirstRecord()) 
{ 
MvgBC.SetFieldValue("SSA Primary Field","Y"); 
}

//To Delete MVG record with Name Rahul
MvgBC.ClearToQuery(); 
MvgBC.SetSearchSpec("Name","Rahul"); 
MvgBC.ExecuteQuery(); 
if (MvgBC.FirstRecord()) 
{ 
MvgBC.DeleteRecord(); 
}

//After Adding/removing Save the record
WriteRecord(); 
}

 

How to add  values from Picklist Buscomp ?

var oBC = this.BusComp();
oBC.NewRecord(NewAfter);
oBC.ActivateField("Status");
oBC.SetFieldValue("Status","Active"); //not using pick() as for static picklist direct value can be given
var oAccBC = oBC.GetPicklistBusComp("Account");
with (oAccBC)
{
ClearToQuery();
SetViewMode(3);
SetSearchSpec("Id", "xxxx");
ExecuteQuery();
If(FirstRecord())
Pick();
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *