Showing posts with label RunTimeEvent. Show all posts
Showing posts with label RunTimeEvent. Show all posts

Thursday, August 28, 2014

Quote Catalog not Loading

 

We faced a peculiar issue on the Quote Catalog view , Siebel version 8.1.1.11 SIA [23030].

When users went to the Quote Catalog view, which is where one starts adding products to the quote for the Pricing Engine, they noticed the Catalog did not load. This happened usually on the the first quote after login.

image

But once the Price List of the Quote was selected, or reselected, and the view was refreshed, the Catalog Items would start appearing.

The Business Component is [Quote Catalog Internal Product by Price List Optional] and it has a user property [SetPriceListSearch] set to ‘Y’. A simple search brings the bookshelf where it is mentioned that

‘This user property indicates whether the [Price List Id] = GetProfileAttr("PriceListId") search specification is applied to the business component. By default, it is set to Y, so only products in the current price list are displayed.’

Turns out, this is one of those many vanilla Profile Attributes managed by Siebel itself. It is set  to the Quote’s Price List’s Id when a Price List value is selected in the Quote. Otherwise, it is blank.

Try out this in the browser ui: javascript:alert(theApplication().GetProfileAttr("PriceListId"));

image

So the issue happens only for the first Quote selected by the user after login, if he has not changed the PriceList value of the Quote. The profile attribute is not set, even if there is already a Price List value at the Quote.

Inorder to fix this, I added a simple RunTimeEvent on the QuoteForm applets’ DisplayApplet event.

 

image

Action Set:

image

This would set the value of this ProfileAttribute when the Quote applet is loaded. With this fix in place, the Catalog items now appear correctly.

image

Trying out : javascript:alert(theApplication().GetProfileAttr("PriceListId"));

image

The other way to fix this is to disable the BC User property, so that items from every Price list is visible. But this would depend on your business use case.

Saturday, November 13, 2010

Differentiating New Record & Update Record


There are cases when a particular data validation or Business  Process invocation should only occur when  a new record is being written down to the database, but not when an existing record is being updated. Or it may be the other way around, but the Siebel developer has to figure out what operation is happening.  I have found many ways these can be achieved, here are my favourite three.

1.       Using a Boolean flag in script.  This is how I first implemented such a scenario.  I was new to Siebel and hadn't yet mastered all the scripting events .  Easiest way out seemed to declare a Boolean flag in the declarations section of the Buscomp server script, and giving it a default value of false. Then in NewRecord  event,  this flag should be turned to true. Finally, in the PreWriteRecord or WriteRecord event, the value of this flag could be checked, and new records can be differentiated fromo exisiting records.

2.       RunTime events. This is a No-Scripting approach to the same problem. In Runtime events, if you select the buscomp events supported, it can be seen that Siebel now provides three events for WriteRecord operation :

·         WriteRecord : Triggered everytime after records are committed.

·         WriteRecordNew : Triggered only when new records are committed.

·         WriteRecordUpdated: Triggered only when existing records are updated.

But these events only occur AFTER the records are committed. They can't be used to do validation/invocation before records are committed.

3.       IsNewRecordPending. This is a new specialised Busines Component Method, meant for EBCs, documented here.  But on trying the command out, I found that it works perfectly well in normal business components as well.  This method can be invoked from any other event in BC level, but it only makes sense to invoke it in the PreWriteRecord section.

var isNewRecord = this.InvokeMethod("IsNewRecordPending");

This way new records can be differentiated from old records before they are committed to the system.