You are here

Accessing Siebel Environment from Dot Net in C#.net

Siebel provides object interface to access Siebel Objects like Business Component, Business Object, Business services, Fields etc to be accessed from .Net, you can integrate Siebel and .Net using below steps.

Add the reference for the Siebel Data Object:

Add the “Siebel Business Object Interfaces Type Library” as reference which is available under COM tab in the add reference dialog box

Create one instance for SiebelBusObjectInterfaces:

public SiebelBusObjectInterfaces.SiebelDataControlClass SiebApp;

Login to Siebel Environment:

Mention the corresponding values for SiebelHost, EnterpriseServer and ObjectManager

string SiebLogin=”xxx”;
string SiebPassword=”xxx”;
string ConnectString = "host=\"siebel://" +
SiebelHost.ToString() + "/" +
EnterpriseServer.ToString() + "/" +
ObjectManager.ToString() + "/\"";
Boolean Ret = SiebApp.Login(ConnectString, SiebLogin.ToString(),SiebPassword.ToString());

If the value is true then the login is successful

Handling Siebel Objects from .Net :

Accessign Siebel object in .net is almost similar to Siebel script

Eg

following example shows how to access Busines object, Business service etc.:

SiebelBusObjectInterfaces.SiebelBusObject SiebBO;
SiebelBusObjectInterfaces.SiebelBusComp siebActionBC;
SiebelBusObjectInterfaces.SiebelService SiebSvc;
SiebelBusObjectInterfaces.SiebelPropertySet SiebInput;
SiebelBusObjectInterfaces.SiebelPropertySet SiebOutput;
SiebelBusObjectInterfaces.SiebelPropertySet SiebChild;
//ROWID IS THE ONLY INPUT FOR THE BELOW PROCESS-- strRowId
try
{
//Getting Siebel BO
SiebBO = SiebApp.GetBusObject("Action");
if (Convert.ToInt32(SiebApp.GetLastErrCode().ToString()) != 0)
{
//Process :error handling
}
//Getting the AIC Action BC
siebActionBC = SiebBO.GetBusComp("Action");
if (Convert.ToInt32(SiebApp.GetLastErrCode().ToString()) != 0)
{                   
//Process :error handling

}
//Getting the 'Server Request' Business Service
SiebSvc = SiebApp.GetService("Server Requests");
if (Convert.ToInt32(SiebApp.GetLastErrCode().ToString()) != 0)
{
//Process :error handling

}
//PropertySet for Workflow
SiebInput = SiebApp.NewPropertySet();
SiebOutput = SiebApp.NewPropertySet();
SiebChild = SiebApp.NewPropertySet();

//Executing Query----Search Spec
siebActionBC.ClearToQuery();
siebActionBC.ActivateField("Activity SR Id");                                                                   

            siebActionBC.SetViewMode(3);
siebActionBC.SetSearchExpr("[Id]='" + strRowId + "'");
siebActionBC.ExecuteQuery(1);
blnRecords = siebActionBC.FirstRecord();
if (blnRecords)
{
lngNumRecords = lngNumRecords + 1;

//WorkFlow Process Name
Process_Name = "Activity Asynchronous Process";

      //Getting the required field values in variables

strWorkItemID = siebActionBC.GetFieldValue("Activity SR Id");
//SiebChild Property set

SiebChild.SetProperty("RowId", strRowId);
SiebChild.SetProperty("ProcessName", Process_Name);
SiebChild.SetProperty("SearchSpec", "[Id]='" + strRowId + "'");
SiebChild.SetProperty("WorkParentId", strWorkItemID);

//Fetching SiebChild to SiebInput
SiebInput.SetProperty("Component", "WfProcBatchMgr");
SiebInput.SetProperty("Mode", "DirectDb");
SiebInput.AddChild(SiebChild);
if (Convert.ToInt32(SiebApp.GetLastErrCode().ToString()) != 0)
{
//Process :error handling
}
//Invoking WorkFlow
SiebSvc.InvokeMethod("SubmitRequest", SiebInput, SiebOutput);
if (Convert.ToInt32(SiebApp.GetLastErrCode().ToString()) != 0)
{
//Process :error handling
}
else
{
Console.WriteLine("\r\nSuccessful save for SR " + strRowId + "\r\n");
}
}
}