You need to sign in to do that
Don't have an account?
Email Service
i am creating Email Service class my requirement is when task status is completed then email will sent to assign contact persion emai id...so.....i am new to Email service concept.please help me...here is my code
global class emailservice implements Messaging.InboundEmailHandler {
global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,
Messaging.InboundEnvelope env){
// Create an inboundEmailResult object for returning
// the result of the Force.com Email Service
Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
task te=[select id,status,whoid from task limit 1];
Contact c=[select id,lastname,Account.Name,email from contact where id=:te.whoid];
String myPlainText = 'I spoke with '+c.lastname+ 'today from '+ ' '+c.account.name +' '+'about the latest proposal.';
// Add the email plain text into the local variable
try
{
myPlainText = email.plainTextBody.substring(0, email.plainTextBody.indexOf('<stop>'));
}
catch (System.StringException e)
{
myPlainText = email.plainTextBody;
System.debug('No <stop> in email: ' + e);
}
// Set the result to true, no need to send an email back to the user
// with an error message
if(te.status=='completed')
result.success = true;
// Return the result for the Force.com Email Service
return result;
}
}
Hi GSP,
Your requirement can be fullfill through Trigger No need to write Email service.
you have to write Trigger on Task object for send Email Functionality..
Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
My Blog:- http://mrjavascript.blogspot.in/
i done this requirement using trigger,but i client wants implements email services.....so....i cant do it....
But, Email service is not perform on any DML operation. Here. Task update...