You need to sign in to do that
Don't have an account?
Jayee
how to bind firstname , lastname in contact object list to show on the table row
i have this code
-> parameter value shows fullname but
in org's row , it shows nothing
to show this on the table row how should i edit these codes?
Thank you!
public void addMore() { try{ string nameT = Apexpages.currentPage().getParameters().get('nameT'); string phoneT = Apexpages.currentPage().getParameters().get('phoneT'); string emailT = Apexpages.currentPage().getParameters().get('emailT'); //string temporaryLastNameValue; //string temporaryFirstNameValue; system.debug('[addMore] param : ' +nameT + '//' + phoneT + '//' + emailT); Contact att = new Contact(); att.lastname = nameT; att.phone = phoneT; att.email = emailT; contactList = new List<Contact>(); List<Contact> con = [SELECT Name, FirstName, LastName FROM Contact WHERE Name = : nameT]; contactList.add(att); insert contactList; //it displays nothing on the row... //maybe it needs to be bind both firstname and lastname }catch(Exception e){ System.debug('[CONTACT] message : ' + e.getMessage()); System.debug('[CONTACT] LineNumber : ' + e.getLineNumber()); System.debug('[CONTACT] Cause : ' + e.getCause()); }system.debug('[addMore] param : ' +nameT + '//' + phoneT + '//' + emailT);
-> parameter value shows fullname but
in org's row , it shows nothing
to show this on the table row how should i edit these codes?
Thank you!
You can do like this. Please try below code.
Hope this helps you.
public void addMore() {
try{
string nameT = Apexpages.currentPage().getParameters().get('nameT');
string phoneT = Apexpages.currentPage().getParameters().get('phoneT');
string emailT = Apexpages.currentPage().getParameters().get('emailT');
//string temporaryLastNameValue;
//string temporaryFirstNameValue;
system.debug('[addMore] param : ' +nameT + '//' + phoneT + '//' + emailT);
List<String> nameList = new List<String>();
//split your name in which form you are entering like entering space or hyphen etc.
nameList = nameT.split('-');
system.debug('Split Name List is::: '+nameList);
system.debug('nameList[0]--->'+nameList[0]);
system.debug('nameList[1]--->'+nameList[1]);
contactList = new List<Contact>();
Contact att = new Contact();
att.Firstname = nameList[0];
att.LastName = nameList[1];
att.phone = phoneT;
att.email = emailT;
contactList.add(att);
insert contactList;
List<Contact> con = [SELECT Name, FirstName, LastName FROM Contact WHERE Name = : nameT];
}
catch(Exception e){
System.debug('[CONTACT] message : ' + e.getMessage());
System.debug('[CONTACT] LineNumber : ' + e.getLineNumber());
System.debug('[CONTACT] Cause : ' + e.getCause());
}
Please mark it as best answer if you find helpful.
Thank You
Ajay Dubedi
Thank you for your comment.
i tried this code but i wont work like this