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

Disable Trigger ( insert, update) while entering records in Details field

I have a Master - Detail Relationship. I dont want duplicate records in Master field. I placed a trigger (insert, update) which doesn't allow duplicate entry into the database.

Now when i update the detail field the trigger on master gets executed and it prevents me to insert data displaying that the record that i am entering is duplicate. I inferred that the update trigger gets executed even when i am entering detail record values. I dont want this to happen.

Can anyone suggest a solution of how to prevent the trigger from executing when i am entering data in the detail field.


can you please show code for the trigger.



You can check the below conditions in trigger where ever you need..

// if insert


   //Code here



//if update


   //Code here