You need to sign in to do that
Don't have an account?
Linda 98
Display error pop up from apex class-URGENT
Hi
i have a apex class which sends email.That apex class is called in custom button.All works fine.
Now i had introduced a condition when the apex class has to be executed.It wrks fine.But i want a way to show to user that the button was exeecuted and what happened like 'success' -when m condition becomes true and 'email not sent' -when the condition becomes false.
please help.
my apex class:
global class SendemailController{
webservice static void sendEmail(id oppid){
ifMY IF CONDITION){ //MY IF CONDITION
System.debug('**********T.ownerid');
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTargetObjectId(Ownerid) ;
mail.setWhatId(oppid) ;
/*
MY OTHER LOGIC
*/
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
my custom buttn which send's email:
{!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')}
{!REQUIRESCRIPT('/soap/ajax/29.0/apex.js')}
document.location.reload(true);
var result = sforce.apex.execute('SendemailController','sendEmail,{oppid:'{customobject__c.Id}'});
Please help!!
i have a apex class which sends email.That apex class is called in custom button.All works fine.
Now i had introduced a condition when the apex class has to be executed.It wrks fine.But i want a way to show to user that the button was exeecuted and what happened like 'success' -when m condition becomes true and 'email not sent' -when the condition becomes false.
please help.
my apex class:
global class SendemailController{
webservice static void sendEmail(id oppid){
ifMY IF CONDITION){ //MY IF CONDITION
System.debug('**********T.ownerid');
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTargetObjectId(Ownerid) ;
mail.setWhatId(oppid) ;
/*
MY OTHER LOGIC
*/
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
my custom buttn which send's email:
{!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')}
{!REQUIRESCRIPT('/soap/ajax/29.0/apex.js')}
document.location.reload(true);
var result = sforce.apex.execute('SendemailController','sendEmail,{oppid:'{customobject__c.Id}'});
Please help!!
and your custom button definition with JS alert: