Siebel User Defined Objects

Ever missed all the OOP goodness in Siebel? Although not used frequently, user defined objects provide you with some degree of control in hiding complexities in scripting. No, this will not help you attain OO nirvana - but you can start doing things with the custom objects and prototyping to:

  • Hide complexity
  • Provide scalability
  • Save memory while doing the above

Here’s a simple example that demonstrates use of user-defined objects. To test, you simply copy the code in a new client business service and you are all set.

First the Service_PreInvoke method:

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
var qryBC;

qryBC = new GetRecord("Contact", "Contact", "[Id] = '0-1'", "First Name", "Last Name");

Outputs.SetProperty("First Name", qryBC.Values[3]);
Outputs.SetProperty("Last Name", qryBC.Values[4]);

return (CancelOperation);
qryBC = null;

Next comes the constructor:


function GetRecord ()
try {

var arrValue = new Array();
var iCount;

if (arguments.length < 4) TheApplication().RaiseErrorText("I need minimum four arguments - BO name, BC name, SearchExpr and at least one field name.");

var bo = TheApplication().GetBusObject(arguments[0]);
var bc = bo.GetBusComp(arguments[1]);

with (bc){
    for (iCount = 3; iCount < arguments.length; iCount++){

if (bc.FirstRecord()) {
    for (iCount = 3; iCount < arguments.length; iCount++){
        arrValue[iCount] = bc.GetFieldValue(arguments[iCount]);
this.Values = arrValue;
} // try


    arrValue = null;
    bc = null;
    bo = null;

The explanation follows:

###### **Purpose**

Provide ability to query any given BO / BC and retrieve the specified field values

###### <strong style="font-size: 15px;">How did we do that?</strong>

First, we create an object called “qryBC”. This becomes instance of a class “GetRecord” when the constructor “GetRecord()” is executed. At this time we also pass the arguments to the object, whereby the constructor will query and return you the results. For simplicity in further processing, we return an array with the query results. Note the use of ‘this’ in the constructor and the reference to the set values when retrieving results in 'PreInvoke' method. We are just letting the constructor do all the work, but this could span into other functions as well.

A note of caution:

- This way of doing things is more familiar to javascript developers, there is not a whole lot of documentation or examples on how this works within Siebel itself
- Make sure that your maintenance team knows how this script works before you go ahead and implement
Tags :
Comments powered by Disqus

Related Posts

HootSuite is the future of CRM

HootSuite is today known as a social media management system. HootSuite is not quite new and is in existence since 2008.

Read More

Using Salesforce as an Authentication Provider

In this post we will see how Salesforce can be used as an authentication ( + authorisation) provider with OpenID connect.

Read More

How to Call Rest APIs

Rest APIs are quite easy to use and my preferred way to get things done.

Read More