You need to sign in to do that
Don't have an account?
Ashw
display account name with out account tail name
Is it possible to display account name with out accounts tail name
example account name: Apple cooperation limit but need to display only Apple
Account name: salesforce Pvt. Ltd need to display only salesforce in vf page this way only account names on vf page with out tail names. Please provide your valuable suggestion
example account name: Apple cooperation limit but need to display only Apple
Account name: salesforce Pvt. Ltd need to display only salesforce in vf page this way only account names on vf page with out tail names. Please provide your valuable suggestion
If you want to change the name of all accounts than you can do something like below :
List<Account> accNameList = [Select Name from Account];
for(Account acc : accNameList ){
acc.Name = acc.Name.split(' ')[0];
}
Now your accNameList will hold all the accounts with modified name.
Let me know if you need more help on this.
Thanks,
Abhishek
All Answers
String accName = Account.Name.split(' ')[0];
It will return you the first word of the account name which is your requirement.
Now use this string in your VF page where you want to show account name.
Let me know if you need more help on this.
Thanks,
Abhishek
thanks for ur reply, If I use array [0] will that returns only one record or all the records from account. I want this to work on all the account records to display on vf page
If you want to change the name of all accounts than you can do something like below :
List<Account> accNameList = [Select Name from Account];
for(Account acc : accNameList ){
acc.Name = acc.Name.split(' ')[0];
}
Now your accNameList will hold all the accounts with modified name.
Let me know if you need more help on this.
Thanks,
Abhishek