To prevent duplicate records in database for any entity such as Service Request, Opportunity or Quote restricting it at table is the best option.
To do that you just need to follow the steps below

  • Go to the Table object in Siebel Tools
  • Select the column which you want to unique
  • Set the Primary Key property for that column to true

And you are done. But this will result in Siebel error message not the message that you want to convey user. If you want to convey a meaningful message to user when he is trying to create a duplicate record then Scripting can give you a solution.

You just need to write a small script at BusComp_PreWrite event and that should solve your problem. Code for that script is given below. Here we are assuming that we want to prevent Oppty with same name and type.


var obj = TheApplication().GetBusObject(“Opportunity”);
var optybc = obj.GetBusComp(“Opportunity”);
With(optybc)
{
ActivateField(“Name”);
ActivateField(“Type”);
SetViewMode(3);
ClearToQuery();
SetSearchSpec(“Name”,this.GetFieldValue(“Name”));
SetSearchSpec(“Type”,this.GetFieldValue(“Type”));
ExecuteQuery(ForwardOnly);
if(FirstRecord())
{
   TheApplication().RaiseErrorText(“Your Message”);
}
}


*Remember that PreWrite event fires everytime you are tyring to save the record. So, you want to include the checks to only fire this code under certain conditions othewise it can result in performance issue while saving your opportunity.

OkAvarageGoodVery GoodExcellent (No Ratings Yet)
Loading ... Loading ...