You need to sign in to do that
Don't have an account?
ishaan singh dhillon
Help with count of records in trigger on Case object
I am trying to write a trigger on Case object where I am trying to retreive the number of how many contacts have the same email as the email from which the case has originated in the web-to-case scenario. But I am getting the error on the first line itself, the error msg is :
Error: Compile Error: Unexpected token '='. at line 3 column 53
I know the code might not be perfect as I am still learning so I am seeking help, the following is the code I have till now:
Thanks in advance.
Regards.
Error: Compile Error: Unexpected token '='. at line 3 column 53
I know the code might not be perfect as I am still learning so I am seeking help, the following is the code I have till now:
trigger CountContact on Case (before insert) { Case.Count_of_Records_with_Web_email_address__c = [select count() from Contact where Contact.Email = Case.SuppliedEmail]; if (Case.Count_of_Records_with_Web_email_address__c > 1) { return; } Else { Contact Cont = [select Contact from Contact where Contact.Email = Case.SuppliedEmail]; Case cas; cas.Email = Cont.Email; cas.Account = Cont.Account; } }
Thanks in advance.
Regards.
You can only access the inserted cases with Trigger.New variable. Try this:
Regards,
MKR