You need to sign in to do that
Don't have an account?
manjunath vivek
Adderror method doesn't display error message, i tried the following Trigger.New[0].name.adderror('Duplicate entry found. There already exists an entry for the same Record. Please update the old one');
Adderror method doesn't display error message, i tried the following Trigger.New[0].name.adderror('Duplicate entry found. There already exists an entry for the same Record. Please update the old one');
Regards
Trigger duplicates on account(before insert){
if(trigger.new[0].Name==trigger.old[0].name)
{
;
Trigger.New[0].name.adderror('Duplicate entry found. There already exists an entry for the same Record. Please update the old one');
}
}
if(trigger.new[0].Name==trigger.old[0].name)
{
Trigger.New[0].name.adderror('Duplicate entry found. There already exists an entry for the same Record. Please update the old one');
}
}
if you are using a before insert tigger , the value of trigger.old is null.
so what i suggest for you to do the below
1- put all the value of trigger.new[0].Name in a list of string.
2- select the account object and put a where conidtion that name in the list of string created.
3- after that you need to verify it exist or not.
Good Luck