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

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.
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.
send an email to account owner saying your account become customer
and create a task and assign it to account owner.
You can create a workflow with your criteria and create a email alert and task for your workflow rule.
Let me know if you need any help in creating the work flow.
Thank you,
Sowmya.
public static void sendemailAndCreateTask(List<Account> accountlist, Map<Id, Account> oldAccountMap) {
Map<Id, Account> mapofAccountWithOwner = new Map<Id, Account>([Select id, owner.Email, ownerid from account where id in:oldAccountMap.keySet() ]);
for (Account a: accountlist){
if(a.Type == 'Customer - Direct' && a.Type != oldAccountMap.get(a.Id).Type) {
Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
String[] sendingTo = new String[]{mapofAccountWithOwner.get(a.Id).Owner.Email};
semail.setToAddresses(sendingTo);
semail.setSubject('Single Email message Example');
semail.setPlainTextBody('your account become customer ');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail});
Task task = new Task();
task.ActivityDate = System.today();
task.ownerId = mapofAccountWithOwner.get(a.Id).Owner.ID;
task.Subject = 'Other';
task.priority= 'High';
task.status = 'Not Started';
task.description = 'New Work';
insert task;
}
}
}
Please let me know if you face any further issue
You can accomplish above requirement using workflow rule.
1.Set Evaluation Criteria: Evaluate the rule when a record is created, and every time it's edited.
2.Rule Criteria: ISCHANGED( AccountType) && ISPICKVAL(AccountType, 'Customer')
3.Add Immidiate workflow actions: Email Alert and New Task.
Hope this helps!
Mark as best answer if it solves your requirement.
Thanks
As per requirement Task should have the account owner as task owner, but with workflow we cannot assign the owner dynamically.
So to achieve this we need to write the apex logic, In my above comment used the APEX logic to fulfill the requirement.
Hoping this helps, Mark as best answer if this resolves your query.
Thanks,
Suresh Beniwal
We can assign Owner dynamically.
Assign To is 'Owner' of Task.