Monday 4 January 2016

Prevent Duplicate records in Siebel

Hi All,

Recently i came across a very useful method to check duplicate values in Siebel.

The basic approach for checking duplicate that comes to our mind is,


  1. Compare the current record with all the previous record before writing to database ,this can be done using scripting but it is much heavy approach and may impact performance.
  2. Suppose there are n records in database and when inserting (n+1) th records, the above approach will query in database and compare the current record with all the existing n records and the performance will be impacted say when n reaches many thousands.


a better way to avoids custom scripting is using the following calculated expression.

BCHasRows("Contact","Contact","[Email Address]='"+[Email Address]+"'","All")

this expression takes in the following argument

BCHasRows(Business Object,Business Component,Field to check,View Mode)
more information can be refered from siebel bookshelf.

I tried this for Checking Checking and Preventing duplicate Email.

Configuration Steps.

1. Create a Calculated field on BC name it

2. Enter following value in Calculated Expression

BCHasRows("Contact","Contact","[Email Address]='"+[Email Address]+"'","All")




3. Check Immediate post changes for the field.

4. In the  BusComp_PreWriteRecord method write following code to raise error text if duplicate Email is entered.

function BusComp_PreWriteRecord ()
{
var IsDuplicate = this.GetFieldValue("DuplicateEmail");

 if(IsDuplicate=="Y")
  {
  TheApplication().RaiseErrorText("Mail Id Already Exist");
  }
return (ContinueOperation);
}

5. Error is raise when Duplicate Email is entered










Hope this was helpful.... cheers

1 comment:

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...