+ Start a Discussion
Sfdc SivaSfdc Siva 

Need help for todisplay contact firstname and lastname

Hi Team,

Am facing to include the contact firstname and last name on below statement.

Your request to grant new partner user access to the traditional partner portal has been provided.
We wants to be display like ":  Your request to grant new user access to the traditional partner portal for ContactFirstName ContactLastName has been provided."
I have tried below statement which is not working.

body=body+'Your request to grant new partner user access to the traditional partner portal for +u.FirstName+', '+u.LastName+ has been provided.<br/><br/>'; 

Can any one please help us for this issue.

Thanks

 
Best Answer chosen by Sfdc Siva
Alap MistryAlap Mistry
Hello Sfdc Siva,
Try given below code:
String body = 'Hi  ';
     if(u.FirstName!=null)
          body=body+u.FirstName+ ' ' ;
     if(u.LastName!=null)
          body=body+u.LastName ;
body=body+'<br/><br/>';


or



String body = 'Hi  ';
     if(u.FirstName!=null)
          body=body+u.FirstName+ '\t' ;
     if(u.LastName!=null)
          body=body+u.LastName ;
body=body+'<br/><br/>';
If error is occur, then post here. If it is useful, then mark it as best answer (for close this thread).
Regards,
Alap Mistry

All Answers

Alap MistryAlap Mistry
Hello Sfdc Siva,
Try this code.
body=body+'Your request to grant new partner user access to the traditional partner portal for' + u.FirstName + ', ' +u.LastName + ' has been provided.\n\n';
If error is occur, then post here. If it is useful, then mark it as best answer (for close this thread).
Regards,
Alap Mistry
Sfdc SivaSfdc Siva
Hi Alap Mistry,

Sorry for the late response.Yes,for me it's working fine.Can you please help me to space between firstname and last name.we are tried below one but there is no space betwee firstname and lastname.

 String body = 'Hi  ';
        if(u.FirstName!=null)
            body=body+u.FirstName ' ;
        if(u.LastName!=null)
            body=body+u.LastName ;
  body=body+'<br/><br/>';

Thanks
Alap MistryAlap Mistry
Hello Sfdc Siva,
Try given below code:
String body = 'Hi  ';
     if(u.FirstName!=null)
          body=body+u.FirstName+ ' ' ;
     if(u.LastName!=null)
          body=body+u.LastName ;
body=body+'<br/><br/>';


or



String body = 'Hi  ';
     if(u.FirstName!=null)
          body=body+u.FirstName+ '\t' ;
     if(u.LastName!=null)
          body=body+u.LastName ;
body=body+'<br/><br/>';
If error is occur, then post here. If it is useful, then mark it as best answer (for close this thread).
Regards,
Alap Mistry
This was selected as the best answer
Sfdc SivaSfdc Siva
Hi Alap,

Thank for your help.Now am able to see the space between Firstname and Lastname.

Thanks
Alap MistryAlap Mistry
Hello Sfdc Siva,
Please mark it as best answer for close this thread.
Regards,
Alap Mistry