+ Start a Discussion
SiddySiddy 

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.
rohitsfdcrohitsfdc

hi,

can you please show code for the trigger.

 

Rajesh_SFGRajesh_SFG

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

// if insert

if(System.Trigger.isInsert){

   //Code here

}

 

//if update

 if(System.Trigger.isUpdate){

   //Code here

}