• Zuhair Shaikh
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
Hello folks. I have a custom object containing 125 records, from Joe Smith1 to Joe Smith125 (The numbers are part of the last name). I want to make a visualforce page that has one textbox and one button and if you enter a number like "12" in the text box and hit the button, it should then list all the records where Fname+Lname(Custom fields in the custom object) contain "12". The list should also be in a table/grid. I'd also appreciate help with creating a custom controller for this page.

This seems like a simple problem but none of the visualforce workbooks I have gone through let me know how to accomplish something like this. Thanks in advance.
Hello. First time poster. I feel like this is an easy problem but I seem to be stuck at actually updating the records. So essentially, I need to create a class that will, for each account in system, update Contact_Email_List__c (which I have created) with the list of email ids (comma separated) from Contact related list of account.
public class EmailListMaker {   
    public void EmailListMaker(){
        List<String> emails = new List<String>();
        for (Contact em : [Select Email FROM Contact ORDER BY Name]){
            emails.add(em.Email);
        }
        String emailList = String.join(emails, ', ');           
        upsert emailList Account.Fields.Contact_Email_List__c;
    }
}

It gives the following problem, "DML requires SObject or SObject list type: String". I feel like I need to transfer the string to a SObject but I can't seem to figure out how. 



 
Hello folks. I have a custom object containing 125 records, from Joe Smith1 to Joe Smith125 (The numbers are part of the last name). I want to make a visualforce page that has one textbox and one button and if you enter a number like "12" in the text box and hit the button, it should then list all the records where Fname+Lname(Custom fields in the custom object) contain "12". The list should also be in a table/grid. I'd also appreciate help with creating a custom controller for this page.

This seems like a simple problem but none of the visualforce workbooks I have gone through let me know how to accomplish something like this. Thanks in advance.
Hello. First time poster. I feel like this is an easy problem but I seem to be stuck at actually updating the records. So essentially, I need to create a class that will, for each account in system, update Contact_Email_List__c (which I have created) with the list of email ids (comma separated) from Contact related list of account.
public class EmailListMaker {   
    public void EmailListMaker(){
        List<String> emails = new List<String>();
        for (Contact em : [Select Email FROM Contact ORDER BY Name]){
            emails.add(em.Email);
        }
        String emailList = String.join(emails, ', ');           
        upsert emailList Account.Fields.Contact_Email_List__c;
    }
}

It gives the following problem, "DML requires SObject or SObject list type: String". I feel like I need to transfer the string to a SObject but I can't seem to figure out how.