Virtual Business Component:
Virtual business components (VBCs) are mechanisms in Siebel EAI by which data from an external system can be viewed in Siebel applications without having to replicate that data within the Siebel Database. We will discuss VBC in a series of 4 articles. Here is the first one, which will help you in understanding why we require VBC and what are VBC’s?.
Business Requirement [Data Sharing Problem]
Following are the common cases where we need to pull data from external database using VBC
1. Users want to access data anywhere in the enterprise
2. Users want to use the same user interface to access any data
3. Users want to display and manipulate external data from within a Siebel application without storing it in the Siebel database
Virtual Business Component Solution
1. Uses a class of business component based on data stored outside of the Siebel database
2. Is defined and behaves like a regular business component
3. Displays data from a external application in a Siebel applet
4. Does not store the external data in the Siebel database
Mapping Virtual Business Components
1. An applet maps to a VBC and is included in a business object (View) just like a regular business component
2. A business object can contain regular business components and virtual business components
VBCs Rely on Business Service and Scripting
A regular Siebel business component uses a C++ Class
(such as CSSBusComp) to manipulate data in the Siebel database
1. Query for records
2. Modify records
3. Create records
4. Delete records
A virtual business component requires a business service with a script to manipulate data in an external application
1. Query for records
2. Modify records
3. Create records
4. Delete records
Data Manipulation Methods
A VBC requires a business service to provide the following standard methods for manipulating external data
1. Init (required)
2. Query (required)
3. Preinsert (optional)
4. Insert (optional)
5. Update (optional)
6. Delete (optional)
The VBC business service may also map Siebel data to external data
VBCs and EAI Transports
VBCs require an EAI transport to send and receive data
Available transports and interfaces for a VBC include:
1. EAI MQSeries Server Transport
2. EAI MQSeries Application Messaging Interface (AMI)Transport
3. EAI MSMQ Transport
4. EAI File Transport
5. EAI HTTP Transport
6. Microsoft BizTalk 2000
Two Ways to Implement a VBC
Create a custom business service with the necessary scripting
1. Siebel eScript, or
2. Siebel Visual Basic
Use the Siebel XML Gateway Business Service, which comes with the required methods for data access and manipulation
When a Virtual Business Component is Appropriate?
When the external system is the system of record
There is no need to duplicate the external data in the Siebel database
When the data from the external system is not defined within the Siebel schema
When the Siebel application is just one of many applications
Limitations of Virtual Business Components
1.VBCs can only be a child components, never parents
Example: A VBC can provide account detail from an external application only if the Siebel application has the parent account record
2.VBCs do not support many-to-many relationships or joins
3.VBCs cannot be specialized business components
Example: Quotes and Forecasts cannot be implemented as VBCs
4.VBCs cannot contain multi-value groups (MVGs), nor can they be the business components for MVGs
5.VBCs do not support drilldowns and sort capabilities
Both use a named search, which is not possible in a VBC
6.VBC field names must map to field names in the external system
7.VBC detail data cannot appear in a wireless view
A wireless view displays only one (master) applet; a VBC must be a child
8.Mobile users cannot use VBCs
Remote data is not stored in the Siebel database
There is no logging support
This post show how to configure a VBC for invoke an EAI WF with a minumun amount of scripting in siebel:
Steps:
a) Create a VBC based on class “CSSFABCVRec”.
b) Create VBC fields, the Parent Buscomp link and add it into BO.
c) Create an Integration Object based on the VBC created.
Note: this integration object must be contain just one Integration Component based on the VBC created on previous step
d) Create a Business Service based on class “CSSFAExternalService”.
e) Into the BS create a method called “Query”.
f) Into the VBC create the next User Properties:
Name: Value
Outgoing Integration Object Name: Name of the IO previously created
ProcessName: Name of the Workflow Process to be invoked
Service Name: Name of the BS previously created
Enable Caching: N
g) Create an applet based on the VBC. Add this applet to your custom view.
h) If you need to pass arguments to the WF, you can put a little of script into the PreQuery Method of VBC Server Script (for example, set a ProfileAttr
Middle wares:
IBM-WPS, WMB, WTX (Mercator)
webMethods
TIBCO
SCRIPTING PART OF VBC:
VIRTUAL BUSINESS COMPONENT:
Business Component: Any Name
Class: CSSBCVExtern
Business Component User Property:
Name: Service Name
Value: Business Service Name
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
var iOperation = ContinueOperation;
var strMethodInit = "Init";
var strMethodQuery = "Query";
var s = Inputs.GetProperty("Operation");
switch(MethodName)
{
case strMethodInit:
iOperation = Init(Inputs,Outputs);
break;
case strMethodQuery:
Query(Outputs);
iOperation = CancelOperation;
break;
case "Update":
case "PreInsert":
//case "Insert":
//case "Delete":
iOperation = CancelOperation;
break;
default:
break;
}
return iOperation;
}
function Init(Inputs, Outputs)
{
var iOperation = CancelOperation;
try
{
Outputs.SetProperty("Opportunity Name_KC", "");
Outputs.SetProperty("Description_KC", "");
Outputs.SetProperty("Name_KC", "");
Outputs.SetProperty("Status_KC", "");
Outputs.SetProperty("Estimated Close Date_KCIB_KC", "");
Outputs.SetProperty("System Generated Flag_KC", "");
Outputs.SetProperty("Opportunity Row_Id", "");
Outputs.SetProperty("Probability of Close_KCIB_KC", "");
Outputs.SetProperty("Product", "");
return (iOperation);
}
catch (e)
{
var strErrMsg = e.toString();
TheApplication().RaiseErrorText(strErrMsg);
}
finally
{
}
}
function Query(Outputs)
{
try
{
var psPropSet = TheApplication().NewPropertySet();
var strHH_Id = TheApplication().GetProfileAttr("HH_VBC_ID_KC"); // PA set in Household BC
var boHH; // BO for Households
var bcHHOpptys; // BC for HH Assets/Calls
var bcPrtyRel; // BC for Members
var blnFound1; // Found Member record
var blnFound2; // Found Oppty records
var blnFound3; // Found Oppty private records
var strArray = new Array; // Used for deduping the VBC accounts/rows
var i=0; // Integer for Array indices
var todayDate = new Date;
var Days365Ago = AddToDate(todayDate,90,0,0,0,-1);
var strDateSearch = DateToString(Days365Ago);
{
//Find Household Members- 'Party Relationship To' BusComp
var searchexpr = "[Party Id] = '" + strHH_Id + "' AND ([Relationship Type] = 'PRIMARY CLIENT' OR [Relationship Type] = 'RELATED CLIENT')";
boHH = TheApplication().GetBusObject("Household");
bcPrtyRel = boHH.GetBusComp("Party Relationship To");
bcPrtyRel.ClearToQuery();
bcPrtyRel.ActivateField("Related Party Contact Full Name");
bcPrtyRel.ActivateField("Related Party Business Name");
bcPrtyRel.ActivateField("Related Party Id");
bcPrtyRel.ActivateField("Related Party Type");
bcPrtyRel.SetViewMode(AllView);
//bcPrtyRel.SetSearchSpec("Party Id", strHH_Id); //jrh - commented out 10/14/08
bcPrtyRel.SetSearchExpr(searchexpr);
bcPrtyRel.ExecuteQuery(ForwardBackward);
if(bcPrtyRel.FirstRecord())
{
blnFound1 = bcPrtyRel.FirstRecord();
// Cycle thru each Member Record.....
while (blnFound1)
{
//LogMessage(bcPrtyRel.GetFieldValue("Related Party Id") +":"+ bcPrtyRel.GetFieldValue("Related Party Type")+"
"+bcPrtyRel.GetFieldValue("Related Party Contact Full Name")+"
"+bcPrtyRel.GetFieldValue("Related Party Business Name"));
var strSearchPerson = "[Key Contact Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] <> 'Y'";
var strSearchOrg = "[Account Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] <> 'Y'";
var strSearchAddl = "AND (([Status] = 'ENGAGED' OR [Status] = 'IN PROCESS' OR [Status] = 'AVAILABLE') OR (([Status] = 'REJECTED' OR [Status] = 'CLOSED' OR [Status] = 'WITHDRAWN' OR [Status] = 'LOST') AND [Primary Revenue Close Date]>= '" + strDateSearch +"'))";
var finalstrSearchOrg = strSearchOrg + strSearchAddl;
var finalstrSearchPerson = strSearchPerson + strSearchAddl;
// Now Find first Opptys assoc with Members.
bcHHOpptys = boHH.GetBusComp("Opportunity Skinny_KC");
bcHHOpptys.ClearToQuery();
bcHHOpptys.ActivateField("Business_KC");
bcHHOpptys.ActivateField("Description");
bcHHOpptys.ActivateField("Estimated Close Date_KCIB_KC");
bcHHOpptys.ActivateField("Key Contact First Name");
bcHHOpptys.ActivateField("Key Contact Last Name");
bcHHOpptys.ActivateField("Name");
bcHHOpptys.ActivateField("Status");
bcHHOpptys.ActivateField("Secure Flag");
bcHHOpptys.ActivateField("Id");
bcHHOpptys.ActivateField("System Generated Flag_KC");
bcHHOpptys.ActivateField("Master Status_KC");
bcHHOpptys.ActivateField("Key Contact Id");
bcHHOpptys.ActivateField("Account Id");
bcHHOpptys.ActivateField("Probability of Close_KCIB_KC");
bcHHOpptys.ActivateField("Product");
bcHHOpptys.SetViewMode(AllView);
if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Person')
{
//bcHHOpptys.SetSearchExpr("[Key Contact Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] <> 'Y'");// AND [Master Status_KC] = 'A'");
bcHHOpptys.SetSearchExpr(finalstrSearchPerson);
}
else if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Organization')
{
//bcHHOpptys.SetSearchExpr("[Account Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] <> 'Y'");// AND [Master Status_KC] = 'A'");
bcHHOpptys.SetSearchExpr(finalstrSearchOrg);
}
bcHHOpptys.ExecuteQuery(ForwardOnly);
if(bcHHOpptys.FirstRecord())
{
blnFound2 = bcHHOpptys.FirstRecord();
// Cycle thru each Account Record.....
while (blnFound2)
{ // Rec Found... Populate HH Accounts VBC.
if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Person')
{
strArray[i] = bcPrtyRel.GetFieldValue("Related Party Type") + "
" + bcHHOpptys.GetFieldValue("Estimated Close Date_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Id") + "
" + bcHHOpptys.GetFieldValue("Description") + "
" + bcPrtyRel.GetFieldValue("Related Party Contact Full Name") + "
" + bcHHOpptys.GetFieldValue("Name") + "
" + bcHHOpptys.GetFieldValue("Status") + "
" + bcHHOpptys.GetFieldValue("System Generated Flag_KC") + "
" + bcHHOpptys.GetFieldValue("Probability of Close_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Product") + "
" + bcHHOpptys.GetFieldValue("Master Status_KC") + "
" + bcHHOpptys.GetFieldValue("Business_KC") + "
" + bcHHOpptys.GetFieldValue("Key Contact Last Name") + "
" + bcHHOpptys.GetFieldValue("Key Contact First Name") + "
";
i = i + 1;
}
else if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Organization')
{
strArray[i] = bcPrtyRel.GetFieldValue("Related Party Type") + "
" + bcHHOpptys.GetFieldValue("Estimated Close Date_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Id") + "
" + bcHHOpptys.GetFieldValue("Description") + "
" + bcPrtyRel.GetFieldValue("Related Party Business Name") + "
" + bcHHOpptys.GetFieldValue("Name") + "
" + bcHHOpptys.GetFieldValue("Status") + "
" + bcHHOpptys.GetFieldValue("System Generated Flag_KC") + "
" + bcHHOpptys.GetFieldValue("Probability of Close_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Product") + "
" + bcHHOpptys.GetFieldValue("Master Status_KC") + "
" + bcHHOpptys.GetFieldValue("Business_KC") + "
" + bcHHOpptys.GetFieldValue("Key Contact Last Name") + "
" + bcHHOpptys.GetFieldValue("Key Contact First Name") + "
";
i = i+ 1;
}
//i = i + 1;
blnFound2 = bcHHOpptys.NextRecord();
} // While blnFound2 loop
} // If bcHHOpptys first rec loop
//LAP 4/22/9 - added per CL 9672 R2.19
// Now Find first Private Opptys assoc with Members.
bcHHOpptys = boHH.GetBusComp("Opportunity Skinny_KC");
bcHHOpptys.ClearToQuery();
bcHHOpptys.ActivateField("Business_KC");
bcHHOpptys.ActivateField("Description");
bcHHOpptys.ActivateField("Estimated Close Date_KCIB_KC");
bcHHOpptys.ActivateField("Key Contact First Name");
bcHHOpptys.ActivateField("Key Contact Last Name");
bcHHOpptys.ActivateField("Name");
bcHHOpptys.ActivateField("Status");
bcHHOpptys.ActivateField("Secure Flag");
bcHHOpptys.ActivateField("Id");
bcHHOpptys.ActivateField("System Generated Flag_KC");
bcHHOpptys.ActivateField("Master Status_KC");
bcHHOpptys.ActivateField("Key Contact Id");
bcHHOpptys.ActivateField("Account Id");
bcHHOpptys.ActivateField("Probability of Close_KCIB_KC");
bcHHOpptys.ActivateField("Product");
bcHHOpptys.SetViewMode(ManagerView);
strSearchPerson = "[Key Contact Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] = 'Y'";
strSearchOrg = "[Account Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] = 'Y'";
strSearchAddl = "AND (([Status] = 'ENGAGED' OR [Status] = 'IN PROCESS' OR [Status] = 'AVAILABLE') OR (([Status] = 'REJECTED' OR [Status] = 'CLOSED' OR [Status] = 'WITHDRAWN' OR [Status] = 'LOST') AND [Primary Revenue Close Date]>= '" + strDateSearch +"'))";
finalstrSearchOrg = strSearchOrg + strSearchAddl;
finalstrSearchPerson = strSearchPerson + strSearchAddl;
if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Person')
{
bcHHOpptys.SetSearchExpr(finalstrSearchPerson);
}
else if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Organization')
{
bcHHOpptys.SetSearchExpr(finalstrSearchOrg);
}
bcHHOpptys.ExecuteQuery(ForwardOnly);
if(bcHHOpptys.FirstRecord())
{
blnFound3 = bcHHOpptys.FirstRecord();
// Cycle thru each Oppty Record.....
while (blnFound3)
{ // Rec Found... Populate HH Oppty VBC.
if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Person')
{
strArray[i] = bcPrtyRel.GetFieldValue("Related Party Type") + "
" + bcHHOpptys.GetFieldValue("Estimated Close Date_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Id") + "
" + bcHHOpptys.GetFieldValue("Description") + "
" + bcPrtyRel.GetFieldValue("Related Party Contact Full Name") + "
" + bcHHOpptys.GetFieldValue("Name") + "
" + bcHHOpptys.GetFieldValue("Status") + "
" + bcHHOpptys.GetFieldValue("System Generated Flag_KC") + "
" + bcHHOpptys.GetFieldValue("Probability of Close_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Product") + "
" + bcHHOpptys.GetFieldValue("Master Status_KC") + "
" + bcHHOpptys.GetFieldValue("Business_KC") + "
" + bcHHOpptys.GetFieldValue("Key Contact Last Name") + "
" + bcHHOpptys.GetFieldValue("Key Contact First Name") + "
";
i = i + 1;
}
else if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Organization')
{
strArray[i] = bcPrtyRel.GetFieldValue("Related Party Type") + "
" + bcHHOpptys.GetFieldValue("Estimated Close Date_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Id") + "
" + bcHHOpptys.GetFieldValue("Description") + "
" + bcPrtyRel.GetFieldValue("Related Party Business Name") + "
" + bcHHOpptys.GetFieldValue("Name") + "
" + bcHHOpptys.GetFieldValue("Status") + "
" + bcHHOpptys.GetFieldValue("System Generated Flag_KC") + "
" + bcHHOpptys.GetFieldValue("Probability of Close_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Product") + "
" + bcHHOpptys.GetFieldValue("Master Status_KC") + "
" + bcHHOpptys.GetFieldValue("Business_KC") + "
" + bcHHOpptys.GetFieldValue("Key Contact Last Name") + "
" + bcHHOpptys.GetFieldValue("Key Contact First Name") + "
";
i = i+ 1;
}
//i = i + 1;
blnFound3 = bcHHOpptys.NextRecord();
} // While blnFound3 loop
} // If bcHHOpptys first rec loop
//LAP 4/22/9 - END OF CODE added per CL 9672 R2.19
blnFound1 = bcPrtyRel.NextRecord();
} // While blnFound1 loop
} // If bcPartyRel first rec loop
// from here to Catch e Is New & Used for Deduping Accts
// Sort the Array with data....
strArray.sort();
strArray.reverse();
var pos; //Represents position of string strArray[i]
var strId = "";
var strDescription = "";
var strEstimatedCloseDate_KCIB_KC = "";
var strName = "";
var strOpptyName = "";
var strStatus = "";
var strSysGenFlag = "";
var strSecureFlag = "";
var strProbabilityofClose_KCIB_KC = "";
var strProduct = "";
var strDescription_0 = "";
var strEstimatedCloseDate_KCIB_KC_0 = "";
var strName_0 = "";
var strOpptyName_0 = "";
var strStatus_0 = "";
var strSysGenFlag_0 = "";
var strSecureFlag_0 = "";
var MasterStatus = "";
var partyType = "";
var strBusName = "";
var strLName = "";
var strFName = "";
var strFullName = "";
for (var j = 0; j < strArray.length; j++)
{ // Start Loop
psPropSet = TheApplication().NewPropertySet();
pos = 0; //Initialize the position for each pass.
// **** READ ARRAY VALUES
partyType = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + partyType.length + 1;
strEstimatedCloseDate_KCIB_KC = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strEstimatedCloseDate_KCIB_KC.length + 1;
strId = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strId.length + 1;
strDescription = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strDescription.length + 1;
strName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strName.length + 1;
strOpptyName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strOpptyName.length + 1;
strStatus = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strStatus.length + 1;
strSysGenFlag = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strSysGenFlag.length + 1;
strProbabilityofClose_KCIB_KC = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strProbabilityofClose_KCIB_KC.length + 1;
strProduct = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strProduct.length + 1;
MasterStatus = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + MasterStatus.length + 1;
strBusName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strBusName.length + 1;
strLName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strLName.length + 1;
strFName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
strFullName = strFName + " " + strLName;
// LogMessage(" ****** "+j + ": " + strArray[j]);
// LogMessage("Prod Old: "+strId_0);
// LogMessage("Prod New: "+strId);
if (strDescription != strDescription_0
strEstimatedCloseDate_KCIB_KC != strEstimatedCloseDate_KCIB_KC_0
strName != strName_0
strOpptyName != strOpptyName_0
strStatus != strStatus_0
strSysGenFlag != strSysGenFlag_0
strSecureFlag != strSecureFlag_0)
{
psPropSet.SetProperty("Opportunity Name_KC", strOpptyName);
psPropSet.SetProperty("Description_KC", strDescription);
psPropSet.SetProperty("Status_KC", strStatus);
psPropSet.SetProperty("Estimated Close Date_KCIB_KC", strEstimatedCloseDate_KCIB_KC);
psPropSet.SetProperty("System Generated Flag_KC", strSysGenFlag);
psPropSet.SetProperty("Opportunity Row_Id", strId);
psPropSet.SetProperty("Probability of Close_KCIB_KC", strProbabilityofClose_KCIB_KC);
psPropSet.SetProperty("Product", strProduct);
psPropSet.SetProperty("Master Status_KC",MasterStatus);
/*HRM this conditions added because LOB wanted both contact and Business Name in the child records*/
if(partyType == 'Organization')
{
psPropSet.SetProperty("Name_KC", strName);
psPropSet.SetProperty("Contact Full Name",strFullName);
}
else if(partyType == 'Person')
{
psPropSet.SetProperty("Name_KC", strBusName);
psPropSet.SetProperty("Contact Full Name",strName);
}
Outputs.AddChild(psPropSet);
//LogMessage("Added: "+strProd+"
"+strAcctNbr+"
"+strName+"
"+strReltnshp+"
"+strStatus+"
"+strBankNbr);
strDescription_0 = strDescription;
strEstimatedCloseDate_KCIB_KC_0 = strEstimatedCloseDate_KCIB_KC;
strName_0 = strName;
strOpptyName_0 = strOpptyName;
strStatus_0 = strStatus;
strSysGenFlag_0 = strSysGenFlag;
}
} // FOR Loop
} //end if strHH_Id
}
catch (e)
{
var strErrMsg = e.toString();
TheApplication().RaiseErrorText(strErrMsg);
}
finally
{
//Clean up after yourself....
bcPrtyRel = null;
bcHHOpptys = null;
boHH = null;
psPropSet = null;
}
}
function LogMessage (Inputs)
//*******************************************************
//Description : Function logs messages to output file
//Created : 14/3/8
//Modification History:
//*******************************************************
{
var Msg = Inputs;
//var m_logFile = "\\Siebel\\siebsrvr\\log\\HH_CallRpts_VBC.txt"
var m_logFile = ".\\..\\log\\HH_CallRpts_VBC.txt"; //SK changed logpath 05-18-2010
// if (TheApplication().GetProfileAttr("EAI_INBOUND_LOG") == "ON")
// {
var fp = Clib.fopen (m_logFile, "at+");
if (fp != null)
{
Clib.fputs(Msg, fp);
Clib.fputs("\n", fp);
Clib.fclose(fp);
}
// }
}
Virtual business components (VBCs) are mechanisms in Siebel EAI by which data from an external system can be viewed in Siebel applications without having to replicate that data within the Siebel Database. We will discuss VBC in a series of 4 articles. Here is the first one, which will help you in understanding why we require VBC and what are VBC’s?.
Business Requirement [Data Sharing Problem]
Following are the common cases where we need to pull data from external database using VBC
1. Users want to access data anywhere in the enterprise
2. Users want to use the same user interface to access any data
3. Users want to display and manipulate external data from within a Siebel application without storing it in the Siebel database
Virtual Business Component Solution
1. Uses a class of business component based on data stored outside of the Siebel database
2. Is defined and behaves like a regular business component
3. Displays data from a external application in a Siebel applet
4. Does not store the external data in the Siebel database
Mapping Virtual Business Components
1. An applet maps to a VBC and is included in a business object (View) just like a regular business component
2. A business object can contain regular business components and virtual business components
VBCs Rely on Business Service and Scripting
A regular Siebel business component uses a C++ Class
(such as CSSBusComp) to manipulate data in the Siebel database
1. Query for records
2. Modify records
3. Create records
4. Delete records
A virtual business component requires a business service with a script to manipulate data in an external application
1. Query for records
2. Modify records
3. Create records
4. Delete records
Data Manipulation Methods
A VBC requires a business service to provide the following standard methods for manipulating external data
1. Init (required)
2. Query (required)
3. Preinsert (optional)
4. Insert (optional)
5. Update (optional)
6. Delete (optional)
The VBC business service may also map Siebel data to external data
VBCs and EAI Transports
VBCs require an EAI transport to send and receive data
Available transports and interfaces for a VBC include:
1. EAI MQSeries Server Transport
2. EAI MQSeries Application Messaging Interface (AMI)Transport
3. EAI MSMQ Transport
4. EAI File Transport
5. EAI HTTP Transport
6. Microsoft BizTalk 2000
Two Ways to Implement a VBC
Create a custom business service with the necessary scripting
1. Siebel eScript, or
2. Siebel Visual Basic
Use the Siebel XML Gateway Business Service, which comes with the required methods for data access and manipulation
When a Virtual Business Component is Appropriate?
When the external system is the system of record
There is no need to duplicate the external data in the Siebel database
When the data from the external system is not defined within the Siebel schema
When the Siebel application is just one of many applications
Limitations of Virtual Business Components
1.VBCs can only be a child components, never parents
Example: A VBC can provide account detail from an external application only if the Siebel application has the parent account record
2.VBCs do not support many-to-many relationships or joins
3.VBCs cannot be specialized business components
Example: Quotes and Forecasts cannot be implemented as VBCs
4.VBCs cannot contain multi-value groups (MVGs), nor can they be the business components for MVGs
5.VBCs do not support drilldowns and sort capabilities
Both use a named search, which is not possible in a VBC
6.VBC field names must map to field names in the external system
7.VBC detail data cannot appear in a wireless view
A wireless view displays only one (master) applet; a VBC must be a child
8.Mobile users cannot use VBCs
Remote data is not stored in the Siebel database
There is no logging support
This post show how to configure a VBC for invoke an EAI WF with a minumun amount of scripting in siebel:
Steps:
a) Create a VBC based on class “CSSFABCVRec”.
b) Create VBC fields, the Parent Buscomp link and add it into BO.
c) Create an Integration Object based on the VBC created.
Note: this integration object must be contain just one Integration Component based on the VBC created on previous step
d) Create a Business Service based on class “CSSFAExternalService”.
e) Into the BS create a method called “Query”.
f) Into the VBC create the next User Properties:
Name: Value
Outgoing Integration Object Name: Name of the IO previously created
ProcessName: Name of the Workflow Process to be invoked
Service Name: Name of the BS previously created
Enable Caching: N
g) Create an applet based on the VBC. Add this applet to your custom view.
h) If you need to pass arguments to the WF, you can put a little of script into the PreQuery Method of VBC Server Script (for example, set a ProfileAttr
Middle wares:
IBM-WPS, WMB, WTX (Mercator)
webMethods
TIBCO
SCRIPTING PART OF VBC:
VIRTUAL BUSINESS COMPONENT:
Business Component: Any Name
Class: CSSBCVExtern
Business Component User Property:
Name: Service Name
Value: Business Service Name
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
var iOperation = ContinueOperation;
var strMethodInit = "Init";
var strMethodQuery = "Query";
var s = Inputs.GetProperty("Operation");
switch(MethodName)
{
case strMethodInit:
iOperation = Init(Inputs,Outputs);
break;
case strMethodQuery:
Query(Outputs);
iOperation = CancelOperation;
break;
case "Update":
case "PreInsert":
//case "Insert":
//case "Delete":
iOperation = CancelOperation;
break;
default:
break;
}
return iOperation;
}
function Init(Inputs, Outputs)
{
var iOperation = CancelOperation;
try
{
Outputs.SetProperty("Opportunity Name_KC", "");
Outputs.SetProperty("Description_KC", "");
Outputs.SetProperty("Name_KC", "");
Outputs.SetProperty("Status_KC", "");
Outputs.SetProperty("Estimated Close Date_KCIB_KC", "");
Outputs.SetProperty("System Generated Flag_KC", "");
Outputs.SetProperty("Opportunity Row_Id", "");
Outputs.SetProperty("Probability of Close_KCIB_KC", "");
Outputs.SetProperty("Product", "");
return (iOperation);
}
catch (e)
{
var strErrMsg = e.toString();
TheApplication().RaiseErrorText(strErrMsg);
}
finally
{
}
}
function Query(Outputs)
{
try
{
var psPropSet = TheApplication().NewPropertySet();
var strHH_Id = TheApplication().GetProfileAttr("HH_VBC_ID_KC"); // PA set in Household BC
var boHH; // BO for Households
var bcHHOpptys; // BC for HH Assets/Calls
var bcPrtyRel; // BC for Members
var blnFound1; // Found Member record
var blnFound2; // Found Oppty records
var blnFound3; // Found Oppty private records
var strArray = new Array; // Used for deduping the VBC accounts/rows
var i=0; // Integer for Array indices
var todayDate = new Date;
var Days365Ago = AddToDate(todayDate,90,0,0,0,-1);
var strDateSearch = DateToString(Days365Ago);
{
//Find Household Members- 'Party Relationship To' BusComp
var searchexpr = "[Party Id] = '" + strHH_Id + "' AND ([Relationship Type] = 'PRIMARY CLIENT' OR [Relationship Type] = 'RELATED CLIENT')";
boHH = TheApplication().GetBusObject("Household");
bcPrtyRel = boHH.GetBusComp("Party Relationship To");
bcPrtyRel.ClearToQuery();
bcPrtyRel.ActivateField("Related Party Contact Full Name");
bcPrtyRel.ActivateField("Related Party Business Name");
bcPrtyRel.ActivateField("Related Party Id");
bcPrtyRel.ActivateField("Related Party Type");
bcPrtyRel.SetViewMode(AllView);
//bcPrtyRel.SetSearchSpec("Party Id", strHH_Id); //jrh - commented out 10/14/08
bcPrtyRel.SetSearchExpr(searchexpr);
bcPrtyRel.ExecuteQuery(ForwardBackward);
if(bcPrtyRel.FirstRecord())
{
blnFound1 = bcPrtyRel.FirstRecord();
// Cycle thru each Member Record.....
while (blnFound1)
{
//LogMessage(bcPrtyRel.GetFieldValue("Related Party Id") +":"+ bcPrtyRel.GetFieldValue("Related Party Type")+"
"+bcPrtyRel.GetFieldValue("Related Party Contact Full Name")+"
"+bcPrtyRel.GetFieldValue("Related Party Business Name"));
var strSearchPerson = "[Key Contact Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] <> 'Y'";
var strSearchOrg = "[Account Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] <> 'Y'";
var strSearchAddl = "AND (([Status] = 'ENGAGED' OR [Status] = 'IN PROCESS' OR [Status] = 'AVAILABLE') OR (([Status] = 'REJECTED' OR [Status] = 'CLOSED' OR [Status] = 'WITHDRAWN' OR [Status] = 'LOST') AND [Primary Revenue Close Date]>= '" + strDateSearch +"'))";
var finalstrSearchOrg = strSearchOrg + strSearchAddl;
var finalstrSearchPerson = strSearchPerson + strSearchAddl;
// Now Find first Opptys assoc with Members.
bcHHOpptys = boHH.GetBusComp("Opportunity Skinny_KC");
bcHHOpptys.ClearToQuery();
bcHHOpptys.ActivateField("Business_KC");
bcHHOpptys.ActivateField("Description");
bcHHOpptys.ActivateField("Estimated Close Date_KCIB_KC");
bcHHOpptys.ActivateField("Key Contact First Name");
bcHHOpptys.ActivateField("Key Contact Last Name");
bcHHOpptys.ActivateField("Name");
bcHHOpptys.ActivateField("Status");
bcHHOpptys.ActivateField("Secure Flag");
bcHHOpptys.ActivateField("Id");
bcHHOpptys.ActivateField("System Generated Flag_KC");
bcHHOpptys.ActivateField("Master Status_KC");
bcHHOpptys.ActivateField("Key Contact Id");
bcHHOpptys.ActivateField("Account Id");
bcHHOpptys.ActivateField("Probability of Close_KCIB_KC");
bcHHOpptys.ActivateField("Product");
bcHHOpptys.SetViewMode(AllView);
if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Person')
{
//bcHHOpptys.SetSearchExpr("[Key Contact Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] <> 'Y'");// AND [Master Status_KC] = 'A'");
bcHHOpptys.SetSearchExpr(finalstrSearchPerson);
}
else if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Organization')
{
//bcHHOpptys.SetSearchExpr("[Account Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] <> 'Y'");// AND [Master Status_KC] = 'A'");
bcHHOpptys.SetSearchExpr(finalstrSearchOrg);
}
bcHHOpptys.ExecuteQuery(ForwardOnly);
if(bcHHOpptys.FirstRecord())
{
blnFound2 = bcHHOpptys.FirstRecord();
// Cycle thru each Account Record.....
while (blnFound2)
{ // Rec Found... Populate HH Accounts VBC.
if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Person')
{
strArray[i] = bcPrtyRel.GetFieldValue("Related Party Type") + "
" + bcHHOpptys.GetFieldValue("Estimated Close Date_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Id") + "
" + bcHHOpptys.GetFieldValue("Description") + "
" + bcPrtyRel.GetFieldValue("Related Party Contact Full Name") + "
" + bcHHOpptys.GetFieldValue("Name") + "
" + bcHHOpptys.GetFieldValue("Status") + "
" + bcHHOpptys.GetFieldValue("System Generated Flag_KC") + "
" + bcHHOpptys.GetFieldValue("Probability of Close_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Product") + "
" + bcHHOpptys.GetFieldValue("Master Status_KC") + "
" + bcHHOpptys.GetFieldValue("Business_KC") + "
" + bcHHOpptys.GetFieldValue("Key Contact Last Name") + "
" + bcHHOpptys.GetFieldValue("Key Contact First Name") + "
";
i = i + 1;
}
else if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Organization')
{
strArray[i] = bcPrtyRel.GetFieldValue("Related Party Type") + "
" + bcHHOpptys.GetFieldValue("Estimated Close Date_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Id") + "
" + bcHHOpptys.GetFieldValue("Description") + "
" + bcPrtyRel.GetFieldValue("Related Party Business Name") + "
" + bcHHOpptys.GetFieldValue("Name") + "
" + bcHHOpptys.GetFieldValue("Status") + "
" + bcHHOpptys.GetFieldValue("System Generated Flag_KC") + "
" + bcHHOpptys.GetFieldValue("Probability of Close_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Product") + "
" + bcHHOpptys.GetFieldValue("Master Status_KC") + "
" + bcHHOpptys.GetFieldValue("Business_KC") + "
" + bcHHOpptys.GetFieldValue("Key Contact Last Name") + "
" + bcHHOpptys.GetFieldValue("Key Contact First Name") + "
";
i = i+ 1;
}
//i = i + 1;
blnFound2 = bcHHOpptys.NextRecord();
} // While blnFound2 loop
} // If bcHHOpptys first rec loop
//LAP 4/22/9 - added per CL 9672 R2.19
// Now Find first Private Opptys assoc with Members.
bcHHOpptys = boHH.GetBusComp("Opportunity Skinny_KC");
bcHHOpptys.ClearToQuery();
bcHHOpptys.ActivateField("Business_KC");
bcHHOpptys.ActivateField("Description");
bcHHOpptys.ActivateField("Estimated Close Date_KCIB_KC");
bcHHOpptys.ActivateField("Key Contact First Name");
bcHHOpptys.ActivateField("Key Contact Last Name");
bcHHOpptys.ActivateField("Name");
bcHHOpptys.ActivateField("Status");
bcHHOpptys.ActivateField("Secure Flag");
bcHHOpptys.ActivateField("Id");
bcHHOpptys.ActivateField("System Generated Flag_KC");
bcHHOpptys.ActivateField("Master Status_KC");
bcHHOpptys.ActivateField("Key Contact Id");
bcHHOpptys.ActivateField("Account Id");
bcHHOpptys.ActivateField("Probability of Close_KCIB_KC");
bcHHOpptys.ActivateField("Product");
bcHHOpptys.SetViewMode(ManagerView);
strSearchPerson = "[Key Contact Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] = 'Y'";
strSearchOrg = "[Account Id] = '" + bcPrtyRel.GetFieldValue("Related Party Id") + "' AND [Secure Flag] = 'Y'";
strSearchAddl = "AND (([Status] = 'ENGAGED' OR [Status] = 'IN PROCESS' OR [Status] = 'AVAILABLE') OR (([Status] = 'REJECTED' OR [Status] = 'CLOSED' OR [Status] = 'WITHDRAWN' OR [Status] = 'LOST') AND [Primary Revenue Close Date]>= '" + strDateSearch +"'))";
finalstrSearchOrg = strSearchOrg + strSearchAddl;
finalstrSearchPerson = strSearchPerson + strSearchAddl;
if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Person')
{
bcHHOpptys.SetSearchExpr(finalstrSearchPerson);
}
else if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Organization')
{
bcHHOpptys.SetSearchExpr(finalstrSearchOrg);
}
bcHHOpptys.ExecuteQuery(ForwardOnly);
if(bcHHOpptys.FirstRecord())
{
blnFound3 = bcHHOpptys.FirstRecord();
// Cycle thru each Oppty Record.....
while (blnFound3)
{ // Rec Found... Populate HH Oppty VBC.
if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Person')
{
strArray[i] = bcPrtyRel.GetFieldValue("Related Party Type") + "
" + bcHHOpptys.GetFieldValue("Estimated Close Date_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Id") + "
" + bcHHOpptys.GetFieldValue("Description") + "
" + bcPrtyRel.GetFieldValue("Related Party Contact Full Name") + "
" + bcHHOpptys.GetFieldValue("Name") + "
" + bcHHOpptys.GetFieldValue("Status") + "
" + bcHHOpptys.GetFieldValue("System Generated Flag_KC") + "
" + bcHHOpptys.GetFieldValue("Probability of Close_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Product") + "
" + bcHHOpptys.GetFieldValue("Master Status_KC") + "
" + bcHHOpptys.GetFieldValue("Business_KC") + "
" + bcHHOpptys.GetFieldValue("Key Contact Last Name") + "
" + bcHHOpptys.GetFieldValue("Key Contact First Name") + "
";
i = i + 1;
}
else if (bcPrtyRel.GetFieldValue("Related Party Type") == 'Organization')
{
strArray[i] = bcPrtyRel.GetFieldValue("Related Party Type") + "
" + bcHHOpptys.GetFieldValue("Estimated Close Date_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Id") + "
" + bcHHOpptys.GetFieldValue("Description") + "
" + bcPrtyRel.GetFieldValue("Related Party Business Name") + "
" + bcHHOpptys.GetFieldValue("Name") + "
" + bcHHOpptys.GetFieldValue("Status") + "
" + bcHHOpptys.GetFieldValue("System Generated Flag_KC") + "
" + bcHHOpptys.GetFieldValue("Probability of Close_KCIB_KC") + "
" + bcHHOpptys.GetFieldValue("Product") + "
" + bcHHOpptys.GetFieldValue("Master Status_KC") + "
" + bcHHOpptys.GetFieldValue("Business_KC") + "
" + bcHHOpptys.GetFieldValue("Key Contact Last Name") + "
" + bcHHOpptys.GetFieldValue("Key Contact First Name") + "
";
i = i+ 1;
}
//i = i + 1;
blnFound3 = bcHHOpptys.NextRecord();
} // While blnFound3 loop
} // If bcHHOpptys first rec loop
//LAP 4/22/9 - END OF CODE added per CL 9672 R2.19
blnFound1 = bcPrtyRel.NextRecord();
} // While blnFound1 loop
} // If bcPartyRel first rec loop
// from here to Catch e Is New & Used for Deduping Accts
// Sort the Array with data....
strArray.sort();
strArray.reverse();
var pos; //Represents position of string strArray[i]
var strId = "";
var strDescription = "";
var strEstimatedCloseDate_KCIB_KC = "";
var strName = "";
var strOpptyName = "";
var strStatus = "";
var strSysGenFlag = "";
var strSecureFlag = "";
var strProbabilityofClose_KCIB_KC = "";
var strProduct = "";
var strDescription_0 = "";
var strEstimatedCloseDate_KCIB_KC_0 = "";
var strName_0 = "";
var strOpptyName_0 = "";
var strStatus_0 = "";
var strSysGenFlag_0 = "";
var strSecureFlag_0 = "";
var MasterStatus = "";
var partyType = "";
var strBusName = "";
var strLName = "";
var strFName = "";
var strFullName = "";
for (var j = 0; j < strArray.length; j++)
{ // Start Loop
psPropSet = TheApplication().NewPropertySet();
pos = 0; //Initialize the position for each pass.
// **** READ ARRAY VALUES
partyType = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + partyType.length + 1;
strEstimatedCloseDate_KCIB_KC = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strEstimatedCloseDate_KCIB_KC.length + 1;
strId = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strId.length + 1;
strDescription = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strDescription.length + 1;
strName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strName.length + 1;
strOpptyName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strOpptyName.length + 1;
strStatus = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strStatus.length + 1;
strSysGenFlag = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strSysGenFlag.length + 1;
strProbabilityofClose_KCIB_KC = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strProbabilityofClose_KCIB_KC.length + 1;
strProduct = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strProduct.length + 1;
MasterStatus = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + MasterStatus.length + 1;
strBusName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strBusName.length + 1;
strLName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
pos = pos + strLName.length + 1;
strFName = strArray[j].substring(pos, strArray[j].indexOf("
", pos));
strFullName = strFName + " " + strLName;
// LogMessage(" ****** "+j + ": " + strArray[j]);
// LogMessage("Prod Old: "+strId_0);
// LogMessage("Prod New: "+strId);
if (strDescription != strDescription_0
strEstimatedCloseDate_KCIB_KC != strEstimatedCloseDate_KCIB_KC_0
strName != strName_0
strOpptyName != strOpptyName_0
strStatus != strStatus_0
strSysGenFlag != strSysGenFlag_0
strSecureFlag != strSecureFlag_0)
{
psPropSet.SetProperty("Opportunity Name_KC", strOpptyName);
psPropSet.SetProperty("Description_KC", strDescription);
psPropSet.SetProperty("Status_KC", strStatus);
psPropSet.SetProperty("Estimated Close Date_KCIB_KC", strEstimatedCloseDate_KCIB_KC);
psPropSet.SetProperty("System Generated Flag_KC", strSysGenFlag);
psPropSet.SetProperty("Opportunity Row_Id", strId);
psPropSet.SetProperty("Probability of Close_KCIB_KC", strProbabilityofClose_KCIB_KC);
psPropSet.SetProperty("Product", strProduct);
psPropSet.SetProperty("Master Status_KC",MasterStatus);
/*HRM this conditions added because LOB wanted both contact and Business Name in the child records*/
if(partyType == 'Organization')
{
psPropSet.SetProperty("Name_KC", strName);
psPropSet.SetProperty("Contact Full Name",strFullName);
}
else if(partyType == 'Person')
{
psPropSet.SetProperty("Name_KC", strBusName);
psPropSet.SetProperty("Contact Full Name",strName);
}
Outputs.AddChild(psPropSet);
//LogMessage("Added: "+strProd+"
"+strAcctNbr+"
"+strName+"
"+strReltnshp+"
"+strStatus+"
"+strBankNbr);
strDescription_0 = strDescription;
strEstimatedCloseDate_KCIB_KC_0 = strEstimatedCloseDate_KCIB_KC;
strName_0 = strName;
strOpptyName_0 = strOpptyName;
strStatus_0 = strStatus;
strSysGenFlag_0 = strSysGenFlag;
}
} // FOR Loop
} //end if strHH_Id
}
catch (e)
{
var strErrMsg = e.toString();
TheApplication().RaiseErrorText(strErrMsg);
}
finally
{
//Clean up after yourself....
bcPrtyRel = null;
bcHHOpptys = null;
boHH = null;
psPropSet = null;
}
}
function LogMessage (Inputs)
//*******************************************************
//Description : Function logs messages to output file
//Created : 14/3/8
//Modification History:
//*******************************************************
{
var Msg = Inputs;
//var m_logFile = "\\Siebel\\siebsrvr\\log\\HH_CallRpts_VBC.txt"
var m_logFile = ".\\..\\log\\HH_CallRpts_VBC.txt"; //SK changed logpath 05-18-2010
// if (TheApplication().GetProfileAttr("EAI_INBOUND_LOG") == "ON")
// {
var fp = Clib.fopen (m_logFile, "at+");
if (fp != null)
{
Clib.fputs(Msg, fp);
Clib.fputs("\n", fp);
Clib.fclose(fp);
}
// }
}
No comments:
Post a Comment