Tuesday, May 18, 2010

EAI Siebel Adapter - Handling Each Record as a Transction

The EAI Siebel Adapter business service is probably the most important (and most widely adopted) EAI business service. It is well documented and most of the EAI professionals know how to handle it.

One thing you come across early is how EAI Siebel Adapter handles the input SiebelMessage objects. Let's consider an example with a SiebelMessage which includes 10 accounts. If we execute for example the upsert method and account number 8 has an invalid value in the status field (picklist errror) then no record is inserted or updated at all.

In other terms, a SiebelMessage is considered a "transaction" and EAI Siebel Adapter "rolls back" all changes made to records when some error occurs during processing of the SiebelMessage.

Sometimes this behaviour is not desirable. For example, you want to send in a batch of updates to Siebel and just want to be notified which records where processed and which not.

The ObjectLevelTransactions input argument is the solution to that problem. If we set it to "True" (and do the same with the StatusObject parameter), EAI Siebel Adapter will treat each single object in the SiebelMessage as a transaction.

It will also return the status object which we can parse in order to find out whether there were any problematic records. They will have an accompanying ErrorMessage property with the error message received during the operation.

Have a nice day

Friday, May 7, 2010

Gateway Server - Audit Trail

When I discuss Siebel Audit Trail in my classes, a frequent question is: "Does it work with the server configuration views?".

I answer this question as follows:

You can try to add the (virtual) business components to the Audit Trail Administration but you would be disappointed with the result. But there's some hope: The built-in Audit Trail for the Siebel Gateway Name Server (and it has nothing to do with the "real" Audit Trail).

This feature is officially documented in the Siebel 8.1 bookshelf and really straightforward. So here is an abstract.

In the gateway.cfg file's [InfraNameServer] section, set the EnableAuditTrail parameter to True (should be default anyway).

With this setting, "most (so says bookshelf) logins, modifications, writes and deletions are logged" to a file named nameserver_audit.log which by its nature resides in the log subdirectory of the Siebel Gateway Name Server installation folder.

This means that we are able to capture all login attempts to the Siebel Gateway Name Server. This could be from the srvrmgr command line utility or from the server admin screens in the Siebel client.

In addition, each modification to the enterprise configuration such as changing parameter settings are logged.

Let's have a look at the file:

It's a tab separated text file with the following columns:
  • Timestamp for the audit entry
  • Record Type such as "Clientconnect" or "WriteRecord"
  • Host name
  • Process Id
  • Client name such as srvrmgr, siebsess or siebmtsh
  • User name
  • Key name (the entry in siebns.dat which has been modified during a WriteRecord event)
  • Value (the new value of the key)
have a nice day

@lex

Wednesday, May 5, 2010

Bookshelf

Recently, I received e-mails and comments from two great contributors to the Siebel CRM community. Coincidentally, both the e-mail from Vladimir from Slovakia and Lennart's comment were about using Google to search the online version of the Siebel Bookshelf.

Vladimir used Google's custom search feature to create the following search engines:








He recommends to integrate the custom search engines into your browser.

These links are also available on the Siebel Bookshelf Page of this blog.
Many thanks, Vladimir!

Lennart described in his comment (which was not published because I decided to create this post, thanks for your patience, Lennart) how to create a simple Siebel Bookshelf search widget to use on any web page.

I have taken the freedom to make the code available for download here.

NamedMethod

Named Method n (Business Component)


This user property allows you to invoke a business component or business service method, or set a field value. It can be used in place of scripting.


Value

The value you provide for the Named Method user property depends on the action you want to perform.

For setting a field value, the value consists of three quoted parameters separated by a comma and a space, as follows:

"Name", "SET", "Field", "Expression"

When Name is called, the value of Field is set using Expression.

For invoking a business component method, the value consists of four quoted parameters separated by a comma and a space, as follows:

"Name", "Action", "BusComp", "Method"

When Name is called, Method is invoked on the BusComp business component based on the defined Action. For a list of actions, see Table 21.

For invoking a business service method, the value consists of five quoted parameters separated by a comma and a space, as follows:

"Name", "Action", "BusComp", "Service", "Method"

When Name is called, Method from the Service business service is invoked on the BusComp business component based on the defined Action. For a list of actions, see Table 21.

You can optionally append an additional parameter that defines an expression. If you use a business service action, the expression is passed as a property set, so you must use name-value pairs rather than an array of strings ("NameExpr", "ValueExpr").

Usage

Sometimes it is necessary to trigger actions in response to data changes, for example when records are created, deleted, or updated. The response can be required to be triggered before or after the date change has been applied.

Within the Siebel Application there is standard functionality, including user properties, to allow you to implement automated responses to data changes without the need to use custom scripts.

The Named Method n user property can be used to invoke methods in a certain order.

For an example of its use, see Named Method n (Applet).

This user property is supported for business components based on the CSSBCBase class.

You can create additional instances of this user property as needed. If you have more than one instance of this user property for a business component, each instance is executed sequentially by number (for example, Named Method 1, then Named Method 2, and so on). If there is only one such user property, then no number is required.

See also About Setting Numbered Instances of a User Property.

Parent Object Type

Business Component

Functional Area

CSSBCBase

Table 21 lists the actions available for the Named Method n user property.

Table 21. Action Values for Named Method n
Action
Method Type
Functional Implication

INVOKE

Business component

Invokes the method

INVOKESEL

Business component

Saves the state and invokes the method once for each selected record

INVOKEALL

Business component

Saves the state, requeries, and invokes the method once for each record

INVOKESAVE

Business component

Saves the state, requeries, and invokes the method

INVOKESVC

Business service

Invokes the method

INVOKESVCSEL

Business service

Saves the state and invokes the method once for each selected record

INVOKESVCALL

Business service

Saves the state, requeries, and invokes the method once for each record

INVOKESVCSAVE

Business service

Saves the state, requeries, and invokes the method

PreCan Invoke

So what does the committed Siebel developer do when it comes to create a button on a Siebel applet?

Of course, you'd start with adding a MiniButton control to the applet layout and specify the method to be invoked in the MethodInvoked property.

Such a button is visible on the applet but not clickable. The reason is that the Siebel framework does not "know" the custom method and the Siebel CanInvokeMethod event handler only enables "known" methods.

Most developers head for the applet script editor and add a server script similar to the following in the PreCanInvokeMethod event handler to enable the button.


The result is that the button is active and clickable, so we can now focus on implementing the desired functionality such as invoking a business service.

BUT: Very often, the script is repeated across dozens or hundreds of applets without any further logic, for example switching the button state depending on user or data attributes. The script just has to "be there" in order to make 'em damn buttons active. So we end up with a lot of script.

Or is there...?

Yes, there are various alternatives which I will discuss in this post.

Named Method User Property

If you wish to have a button which is always active and invokes a method or business service (or Siebel workflow process via the Workflow Process Manager business service), you simply declare the Named Method user property.

Even if you could do it on the applet, why not just do it on the business component? Usually the method should be enabled on all applets on a given BC, shouldn't it?

The syntax for business component side Named Method entries is as follows:

Name: Named Method N (where N is a sequential number)
Value: "MethodName", "INVOKE Command", "INVOKE Arguments"

Here is an example:


There are numerous examples in the Siebel Repository, so we can most probably copy an existing Named Method user prop and modify the sequence number and the value.

More information about the Named Method business component user property and the various "INVOKE" commands can be found in the Siebel Developer's Reference.

Once the Named Method user property is set at either the applet or BC level, the buttons (or Command objects) referencing the method are in an active state. There is NO SCRIPT NEEDED. This technique works at least since Siebel 2000.

CanInvokeMethod Applet User Property

In Siebel 8.0, a new applet user property named CanInvokeMethod has been introduced which is documented here. The benefit of this user property is that its value can be an expression (in Siebel Query Language) which returns TRUE or FALSE. So simple decision logic when to enable or disable a method can be implemented without scripting.

FrameEventMethod prefix

Originating in the "Synthetic Event Button" feature in interactive workflow processes in Siebel 7.7, the quite exotic "FrameEventMethod prefix" allows us to create a button which invokes a method and have it always enabled without the need for script or even user properties.


Using the string "FrameEventMethod" as a prefix for the name of the method to be invoked ensures that the Siebel event framework accepts the method, so it can be easily used in a workflow process event or similar. Don't believe it? Try it!

Summary

The truth about (script in) the PreCanInvokeMethod event handler?
It is rarely ever needed. There are various declarative alternatives which we can use in our everlasting effort to reduce the use of scripting while customizing Siebel CRM.

have a nice day