You need to sign in to do that
Don't have an account?

Trigger Error : Method does not exist or incorrect signature
I'm trying to create a trigger to send an email with an attachment from the "notes and attachments'" object. However it wont compile and give the error: Method does not exist or incorrect signature: ISPICKVAL(Schema.SObjectField, String) at line 3 column 5. I've been banging my head against my desk for the better part of half an hour trying to figure this out. please help.
trigger sendEmailAlert on Opportunity (after insert, after update) { if (ISPICKVAL(opportunity.stagename, 'Send Rebecca Request')){ Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); Attachment[] queryAttachment = [select Name from Attachment where Parentid=:'accountId' order by CreatedDate DESC]; Messaging.EmailFileAttachment[] allAttachments = new Messaging.EmailFileAttachment[queryAttachment.size()]; for(integer i=0;i<queryAttachment.size();i++) { Messaging.EmailFileAttachment fileAttachment = new Messaging.EmailFileAttachment(); fileAttachment.setBody(queryAttachment[i].Body); fileAttachment.setFileName(queryAttachment[i].Name); allAttachments[i] = fileAttachment; }
ISPICKVAL is function that can be used only in formula fields or validation rules
Thanks,
Daya
Thank you!
Do you know what I could use instead then?
You can directly write like
I tried this but got the following error: Compile Error: Comparison arguments must be compatible types: Schema.SObjectField, String at line 4 column 5. Any ideas on how to rectify the situation?