You need to sign in to do that
Don't have an account?
Hemalatha Paruchuri
If any one try to delete my record send email notofication to all profile users
if u want delete my custom object record (estimate) send notofication to all profiles
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
add error method after email sent otherwise it will break after error and will not send the email.
Please select this as Best Answer if it helps you.
All Answers
Can you put in a validation rule and connect it to a trigger to send an email notification to all the profile users.I am just thinking if is possible.
Best Regards
Naga Kiran
Messaging.reserveSingleEmailCapacity(trigger.size);
List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
for (Estimate__c esti : Trigger.old) {
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
esti.addError('Unable to delete record!');
email.setToAddresses(new String[] {'hemalathaparuchuri8@gmail.com'});
email.setSubject('They are try to Delete Estimate Alert');
email.setPlainTextBody('This message is to alert you that the Estimate named ' + esti.Name + ' has been deleted.');
emails.add(email);
}
Messaging.sendEmail(emails);
}
if any body delete my record send notification to that mail.in this code mail is not sending.please verify the code
add error method after email sent otherwise it will break after error and will not send the email.
Please select this as Best Answer if it helps you.
Then on custom button show the alert message and send the email through workflow.
List<id> myids = new List<id>();
List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
for(schema.Account acc: trigger.old){
Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
msg.setToAddresses(new String[]{acc.Email__c});
msg.setSubject('Confirmation from Salesforce');
msg.setPlainTextBody('Hi'+acc.Name+'The record is Successfully Deleted');
//Messaging.sendEmail(Messaging.SingleEmailMessage{msg});
emails.add(msg);
}
Messaging.sendEmail(emails);
}
Try above code, it definetly Works