You need to sign in to do that
Don't have an account?
Dilip Kulkarni
Apex trigger for case alert
Hi Experts,
I want to create a trigger for following case:
Whenever a case is opened and closed for an account of particular region ( e.x. WE- West), the respective inside rep ( it's a sales rep) for that account should get email alert notification. What will be the trigger for this scenario?
I want to create a trigger for following case:
Whenever a case is opened and closed for an account of particular region ( e.x. WE- West), the respective inside rep ( it's a sales rep) for that account should get email alert notification. What will be the trigger for this scenario?
You can write workflow rules or create process Builder for these scenario's.
Going to apex any particular reason?
Thanks,
Gaurav
Skype: gaurav62990
Workflow rule is there, but it sends email alert to every recipient. Here I want to send mail to only concerned rep of that account ( and not others).
In process builder email alerts are not there.
Thanks,
Dilip
ohh in that case, we can have trigger
You can now extend this as per your requirement.
Thanks,
Gaurav
Skype: gaurav62990
Please follow the link below.
Link - https://krishhari.wordpress.com/2013/09/03/dynamically-populating-custom-html-email-template-content-in-force-com-with-custom-dynamic-data-using-apex/
Thanks,
Harshit garg
Thank you very much for your response.
As I am new to apex coding, I will much appreciate if you give complete trigger.
Please let me know if any information is required.
Thanks
please give me the scenario's for sending out emails with field values and conditions.
Thanks,
Gaurav
Skype: gaurav62990
Here we have an account in region for example WE. For this account the field 'inside sales' is there.(which is sales executive). When case is opened and closed for this account 'inside sales' (of this account) should receive email notification. The mail should go to only that particular 'inside sales'. (not the others)
If anything required,please let me know.
Please find sample trigger class, do modify as per your actual needs:
Thanks,
Gaurav
Skype: gaurav62990
Thanks for your kind help. Will it work for both open and closed cases, or it's different trigger when case is closed?
As mentioned in SOQL query object 'contact' is mentioned, while we are mentioning query email address from account object.Is it right?
Could you please clarify what is variable 'c.contactId' for?
Is your case Object directly linked with Account object?
In normal scenario, this goes like below:
Account is parent to Contact.
Contact is parent to Case.
Hence to populate account data, we need to go with Contact --> Account.
Thanks,
Gaurav
Yes, case is having lookup relationship with account name and it's in related list of account.
Hope this helps....
For more you can contact me on skype: gaurav62990
Thanks,
Gaurav
Thank you. I will run the trigger and let you know likewise.
I am having error in class 'Invalid type: SingleEmailMessage'