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,
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
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,
- 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.
- 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);
}
Hope this was helpful.... cheers
Hi how can we do samething using workflow
ReplyDelete