when ever account type is changed form any value to 'Customer' need to send an email to account owner saying your account become customer and create a task and assign it to account owner.

closed as off-topic by Dave Humm, Himanshu, David Reed, Pranay Jaiswal, battery.cord Dec 11 '18 at 14:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Dave Humm, Himanshu, David Reed, Pranay Jaiswal, battery.cord
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    please share what you have tried alongside your specific problem, show a minimum level of effort before posting. additionally, take some time to read How to Ask and take the tour and update your post accordingly. Thanks – Himanshu Dec 11 '18 at 6:04
  • trigger accountype on Account (before insert, before update) { for(Integer i = 0 ; i < Trigger.new.size() ; i++){ if(Trigger.new[i].Type =='Customer') } } – raja reddy Dec 11 '18 at 6:17
  • public with sharing class emailnotify { //static method public static List<Account> sendEmail(List<Account> Accounts) { //query on template object EmailTemplate et=[Select id from EmailTemplate where name=:'Sales: New Customer Email']; //list of emails List<Messaging.SingleEmailMessage> emails = new – raja reddy Dec 11 '18 at 6:24
  • List<Messaging.SingleEmailMessage>(); //loop for(Account Acc : aCCOUNTS){ //check for Account if(Acc.Id == null && Acc.Email != null){ – raja reddy Dec 11 '18 at 6:25
  • //initiallize messaging method Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage(); //set object Id singleMail.setTargetObjectId(Acc.Id); //set template Id singleMail.setTemplateId(et.Id); //flag to false to stop inserting activity history singleMail.setSaveAsActivity(false); //add mail emails.add(singleMail); – raja reddy Dec 11 '18 at 6:25

Create a workflow whenever any account is updated, add a criteria whenever the field value changes to 'customer', create a workflow action and send the email to Account Owner and add one more action of creating a task, and in the 'Assigned To' field, choose the value of the Account Owner.

  • +1 although you can send a notification of the task, so the workflow email may not even be necessary. – sfdcfox Dec 11 '18 at 6:10
  • i want to do it using apex class or triggers .please can you help me out with that – raja reddy Dec 11 '18 at 6:12
  • He has to notify that the customer that the value has been changed. But the task notification contains details regarding the task only. – BHARATH K Dec 11 '18 at 6:12
  • thanks , can't we acheive it using apex class or triggers – raja reddy Dec 11 '18 at 6:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.