function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jason DunphyJason Dunphy 

return table values

Hoping someone can point me the right direction (or just shed light on what newbie faults I’m making), as I’ve been trying to chip away at this and hit a roadblock.

My goal is to have a semi-dynamic VF page to help users quickly capture and set values before committing a new case.  

The init of the page is going to pop as a stand-alone and NO account or contact values will be known or available without user interaction.

After the user selects the account value an inline edit table (would settle for static table though) of all related contacts would appear on the page for the user to reference (instead of having them go through a contact lookup).

I stumbled across this post http://salesforcekings.blogspot.in/2014/05/getting-related-contact-records-as_27.html and manage to get a version of this working, but in my org an account can can many contacts it gets messy really quickly.

Here’s the code I have thus far, which noted below works, but everytime I try to tweak it so it returns a table of contacts I fail to do so:
 
<!-- Visualforce Page -->
<apex:page sidebar="true" StandardController="Case" extensions="contactsForServiceCloud">
    <apex:form >
     <apex:facet name="header">Titles can be overriden with facets</apex:facet>
        <apex:pageBlock title="Create A New Case">
            <apex:pageBlockSection title="My Case" columns="2">
             <apex:outputLabel value="Account Name"> &nbsp;&nbsp;
                
         <apex:inputField value="{!Case.AccountId}" required="false" id="lid">
         <br/><br/><br/>
         <apex:actionsupport event="onchange" rerender="check"/>
         </apex:inputField>
                
         </apex:outputLabel>
               <apex:inputField value="{!Case.ContactId}" />
                <apex:inputField value="{!Case.Description}"/>              
            </apex:pageBlockSection>
        </apex:pageBlock>   
        <center>
                       <apex:outputPanel id="check">
         <apex:outputLabel value="Contacts:" rendered="{!case.AccountId!=null}">
         <apex:selectCheckboxes value="{!selectedAccount}">
           <td> <apex:selectOptions value="{!items}"/></td>
        </apex:selectCheckboxes><br/>
        </apex:outputLabel>
        </apex:outputPanel> 
        </center>
        
        
<apex:commandButton action="{!save}" value="Save" id="theButton"/>
<apex:commandButton onclick="window.open('/003/e?retURL=%2F{!Case.Account}&accid={!Case.AccountId}&&retURL=/{!Case.AccountId}');" value="New Contact" />

           
    </apex:form>
</apex:page>
Apex Class:
public class contactsForServiceCloud
{
public case selectedAccount{get;set;}

 public contactsForServiceCloud(ApexPages.StandardController stdCtrl) {
selectedAccount=(case)stdCtrl.getRecord();
    }

     public List<SelectOption> getItems()
      {
 
      List<Contact> cntList=[SELECT Name From Contact Where ((Contact.account.ParentId=:selectedAccount.AccountID) Or (Contact.account.Id=:selectedAccount.AccountID))];
      List<SelectOption> options = new List<SelectOption>();
        
        for (Contact c:cntList) 
        {
            options.add(new SelectOption(c.Name,c.Name));
        }
        return options;
      }
      

}



Any suggestions would be greatly appreciated,

Thanks