function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
apex code shareapex code share 

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



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.