• vepak
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 28
    Replies

Hi Guys,

 

I've a custom button, when it is clicked it creates new record in another custom object and the user is redirected to newly created record.

 

I use pagereference class to perform this logic. But when I redirect the user to the newly created record, user stays in the visualforce page instead of salesforce instance

 

i.e...  User stays in this URL https:/INSTANCE.visual.force.com/apex/ConvertintoCustomer?scontrolCaching=1&id=a0LE00000001ChS

 

instead of

 

https://INSTANCE.salesforce.com/a0LE00000001ChS

 

How I can redirect user to the above URL instead of visual.force.com

 

 

Thanks,

Vamsi.

  • November 10, 2011
  • Like
  • 0

Hi There,

 

I'm using visualforce page to specify to email address and cc email address to send email.

 

If both to address and cc address are specified my class handling it and working fine.

 

But cc email address field is blank in visualforce page my class coudn't handle and throws error

 

System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Invalid to address : : []

 

NOTE: I ASSUME ONLY ONE EMAIL IS SPECIFIED IN toemail FOR THIS EXAMPLE CODE 

 

public String ccemail {get;set;} 
public String toemail {get;set;}
public String subject {get;set;}
public String body {get;set;}
string[] ccaddress;


if(ccemail!=NULL)
 ccaddress=ccemail.split(',', 0);
    else
    ccaddress=NULL;
    

    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    mail.setUseSignature(false);
    mail.setToAddresses(new string[]{toemail});
    
    
    mail.setCcAddresses(ccaddress);
    
    mail.setSubject(subject);
    mail.setHtmlBody(body);
     
 

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 


Could you please help me in this.

 

Thanks,

Vamsi.

 

  • July 28, 2011
  • Like
  • 0

Hi There,

 

I'm trying to send PDF attachment generated from Visualforce page through scheduled apex email class.

 

I can send PDF attachment using the Email client, but when I am trying to send that automatically using the scheduler PDF attachment is being corrupted 

 

Could you please help me in this.

 

Thanks.

Vamsi.

  • July 27, 2011
  • Like
  • 0

Hello,

 

we are using Google apps email services for our company.  I've set up forwarding email to salesforce from Google apps, the inbound email should process email forwarded from Google apps email and create a case. But I'm not receiving emails to salesforce from google apps.

 

Could you please help me in this issue.

 

Thanks,

Vamsi.

  • July 23, 2011
  • Like
  • 0
 mail.setReferences('References: 1*<'+String.valueOf(b2bcid)+'> CRLF');

Hello guys,

 

if I'm using this in my outbound messages class I'm getting error as

 

System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_MESSAGE_ID_REFERENCE, References header is not valid.: []
Class.WPOSP.B2BRespondtoinquirycontroller.sendResponse: line 59, column 5 External entry point 

 

in the above code String.valueOf(b2bcid) is my record id. I was wondering what will be the syntax of mail.setReferenes method.

 

I also looked at http://tools.ietf.org/html/rfc2822#section-3.6.4 but couldn't understand the syntax.

 

Could you please help me in this.

 

Thanks,

Vamsii

  • July 09, 2011
  • Like
  • 0

For the code below I'm getting error as 

 

Error: Compile Error: Variable does not exist: insert newb2bCase at line 40 column 1

 

can someone help me.

 

 

 

global class processB2Bcasehandler implements Messaging.InboundEmailHandler {
string emailAddress;string fName;string lName;

global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,    Messaging.InboundEnvelope envelope) {    

Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();

// Captures the sender's email address emailAddress = envelope.fromAddress;

// Retrieves the sender's first and last names 

fName = email.fromname.substring(0,email.fromname.indexOf(' '));

lName = email.fromname.substring(email.fromname.indexOf(' '));

// Creates a contact from the information retrieved from the inbound email 
Contact mycontact = new Contact();

try{

mycontact.FirstName = fName;

mycontact.LastName = lName;

mycontact.Email = emailAddress;insert mycontact;}

catch(System.DmlException co)

{

System.debug('ERROR: Not able to create contact:'+ co);

}
// Creates the case 

 

WPOSP__B2B_Case__c newb2bCase = new WPOSP__B2B_Case__c();

try{

newb2bCase.WPOSP__Case_Description__c = email.plainTextBody;

newb2bCase.WPOSP__Case_Subject__c = email.subject;

newb2bCase.WPOSP__Contact_email__c= emailAddress;

newb2bCase.WPOSP__Customer_Name__c=email.fromname;

insert newb2bCase;

}

catch(System.DmlException ca)

{

System.debug('ERROR: Not able to create B2Bcase:'+ ca);

}

return result;

}
}

  • July 08, 2011
  • Like
  • 0


I developed a visualforce page which has Text area field. When I tried to pass the value to string variable in a class it is not handling newline character.

 

for example: if I enter a text below in the visualforce page text aera field

 

"Hello sir,

 

how are you

 

Thanks"

 

 

if I try to print it in a class it prints as  "Hello sir,how are you Thanks" 

 

Can anyone help me in this.

 

Thanks,

Vamsi.

 

  • July 07, 2011
  • Like
  • 0

I developed a visualforce page which has Text area field. When I tried to pass the value to string variable in a class it is not handling newline character.

 

for example: if I enter a text below in the visualforce page text aera field

 

"Hello sir,

 

how are you

 

Thanks"

 

 

if I try to print it in a class it prints as  "Hello sir,how are you Thanks" 

 

Can anyone help me in this.

 

Thanks,

 

Vamsi.

  • July 07, 2011
  • Like
  • 0

Hi Guys,

 

I've a custom button, when it is clicked it creates new record in another custom object and the user is redirected to newly created record.

 

I use pagereference class to perform this logic. But when I redirect the user to the newly created record, user stays in the visualforce page instead of salesforce instance

 

i.e...  User stays in this URL https:/INSTANCE.visual.force.com/apex/ConvertintoCustomer?scontrolCaching=1&id=a0LE00000001ChS

 

instead of

 

https://INSTANCE.salesforce.com/a0LE00000001ChS

 

How I can redirect user to the above URL instead of visual.force.com

 

 

Thanks,

Vamsi.

  • November 10, 2011
  • Like
  • 0

Hi There,

 

I'm using visualforce page to specify to email address and cc email address to send email.

 

If both to address and cc address are specified my class handling it and working fine.

 

But cc email address field is blank in visualforce page my class coudn't handle and throws error

 

System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Invalid to address : : []

 

NOTE: I ASSUME ONLY ONE EMAIL IS SPECIFIED IN toemail FOR THIS EXAMPLE CODE 

 

public String ccemail {get;set;} 
public String toemail {get;set;}
public String subject {get;set;}
public String body {get;set;}
string[] ccaddress;


if(ccemail!=NULL)
 ccaddress=ccemail.split(',', 0);
    else
    ccaddress=NULL;
    

    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    mail.setUseSignature(false);
    mail.setToAddresses(new string[]{toemail});
    
    
    mail.setCcAddresses(ccaddress);
    
    mail.setSubject(subject);
    mail.setHtmlBody(body);
     
 

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 


Could you please help me in this.

 

Thanks,

Vamsi.

 

  • July 28, 2011
  • Like
  • 0

Hi There,

 

I'm trying to send PDF attachment generated from Visualforce page through scheduled apex email class.

 

I can send PDF attachment using the Email client, but when I am trying to send that automatically using the scheduler PDF attachment is being corrupted 

 

Could you please help me in this.

 

Thanks.

Vamsi.

  • July 27, 2011
  • Like
  • 0

Hello,

 

we are using Google apps email services for our company.  I've set up forwarding email to salesforce from Google apps, the inbound email should process email forwarded from Google apps email and create a case. But I'm not receiving emails to salesforce from google apps.

 

Could you please help me in this issue.

 

Thanks,

Vamsi.

  • July 23, 2011
  • Like
  • 0