+ Start a Discussion
larrmill59larrmill59 

How to populate a space into a field

I'm sure this is a very simple thing but none of the code samples I look at have an example of this.

 

One of the fields I'm trying to populate using a trigger is called Account Executive. I'm pulling the first and last name using account owner. I am able to concatenate the two values, but how do I get a space to appear between the first and last names? Please see the section of code below.

 

 for(RME__c a: trigger.new){
  for  (Account Acct : [select id,owner.FirstName,owner.LastName from account where id = :a.account__c])
           {
   a.Account_Executive__c = Acct.owner.FirstName + Acct.owner.LastName;

 

If there is a different way to get the full name into this field, that would be fine too.

 

Thank you,

Larry

Best Answer chosen by Admin (Salesforce Developers) 
_Prasu__Prasu_

 

 a.Account_Executive__c = Acct.owner.FirstName + ' ' + Acct.owner.LastName;

 

try the above thing.

 

All Answers

_Prasu__Prasu_

 

 a.Account_Executive__c = Acct.owner.FirstName + ' ' + Acct.owner.LastName;

 

try the above thing.

 

This was selected as the best answer
larrmill59larrmill59

I knew it would be a simple thing. I was doing the same thing but with double quotes.

 

Thanks