You need to sign in to do that
Don't have an account?
kranthi kumar madanamoni
How can i achieve this condition?
when status__c= true && price__C>3000, update status__c=false and send email using email template to u1@gmail.com using trigger
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Which object you want to write trigger ?
https://developer.salesforce.com/forums/?id=906F00000008yhSIAQ
In Trigger you can write the condition like below and inside that you can write a code to send an email.
below is the sample code you can try inside your trigger.
if( status__c= true && price__C>3000, update status__c=false)
{
EmailTemplate et = [Select e.Id,e.Name,e.subject,e.BrandTemplateId From EmailTemplate e where e.Name='XXXXXXXx' Limit 1];
List<Messaging.SingleEmailMessage> mess = new List<Messaging.SingleEmailMessage>();
list<string> TAdd = new list<string>();
TAdd.add('u1@gmail.com');
Messaging.SingleEmailMessage smail = new Messaging.SingleEmailMessage();
smail.setTargetObjectId(obj.ownerId); // Object OwnerID
smail.setTemplateId(et.Id);
smail.setToAddresses(TAdd);
smail.setWhatId(obj.Id); // Object Id
mess.add(smail);
Messaging.sendEmail(mess);
}
Hope this helps!
Thanks