+ Start a Discussion
apex code shareapex code share 

Please help me writing trigger for preventing duplicate records to be saved on custom object

Hi,

 

I have a custom object name "Product Segments"  and when someone click new to enter new product segments then it should check whether the record already exist or not ,,if exist then it should throw an error 

 

trigger should check on these field "Product Segment Name",,"Product Segment Code" and "Product Category Name".

 

if any record consist of same values in above field which already exists in system then it should not be saved.