• Andre Green 9
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have a few questions. Please Please HELP!!!! ASAP
1.  I am trying to develop a account search page.  The results must include the following columns account name, billing state/province, phone and website.  The code I have so far but it is not coming back with the accounts.

2.   Develop a grid of accouunt which can be selected.  Once selected and the "Show Selected Accounts" button is clicked, information from the selected accounts is displayed in the "Selected Accounts" table.  How do I do this and were do I start.  The code I have is is bringing up contacts not accounts. 

3.  Produce a page which displays Accounts and related contact using only one query.

1. CODE
<apex:page controller="theController">
   <apex:form >
      <apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection title="Search" id="search">
            <apex:pageBlockSectionItem >
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup >
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Search!" action="{!doSearch}"  rerender="block" status="status"/>
               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="Requesting..."/>
        <apex:pageBlockSection title="Results" id="results" columns="1">
           <apex:pageBlockTable value="{!results}" var="l"  rendered="{!NOT(ISNULL(results))}">
              <apex:column value="{!l.name}"/>
              <apex:column value="{!l.email}"/>
              <apex:column value="{!l.phone}"/>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>

2.  CODE 
<apex:page controller="wrapperClassController1">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Selected Accounts" action="{!processSelected}" rerender="table"/>
            </apex:pageBlockButtons>
            <!-- In our table we are displaying the cContact records -->
            <apex:pageBlockTable value="{!contacts}" var="c" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!c.selected}"/>
                </apex:column>
                <!-- This is how we access the contact values within our cContact container/wrapper -->
                <apex:column value="{!c.con.Name}" />
                <apex:column value="{!c.con.Email}" />
                <apex:column value="{!c.con.Phone}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

3.  CODE  APEX

public class accountcontact1
{
    list<AccountWrapper> wraplist=new list<AccountWrapper>();
    public accountcontact1()
    {
       Map<Id, AccountWrapper> accMap=new Map<Id, AccountWrapper>();
       for(account a:[SELECT createdby.name,CreatedbyID,Account.Name,(SELECT      
                name,Contact.FirstName, Contact.LastName 
                FROM Account.Contacts) FROM Account])
       {
     AccountWrapper accWrap=accMap.get(a.CreatedBy.name);  
          // AccountWrapper accWrap=accMap.get(a.CreatedBy.name);
           if (null==accWrap)
           {
              accWrap=new AccountWrapper();
              accMap.put(a.CreatedByname, accWrap);
              accWrap.userid=a.CreatedByid;
           
             // accMap.put(a.CreatedBy.name, accWrap);
              accWrap.username=a.CreatedBy.name;
           }
           accWrap.accounts.add(a);
       }
       wrapList=accMap.values();
   }
   public list<AccountWrapper> getaccounts()
   {
      return wraplist;
   }
   public class AccountWrapper
   {
  public id userid {get; set;} 
      public string username {get; set;}
      public List<Account> accounts {get; set;}
      public AccountWrapper()
      {
         accounts=new List<Account>();
      }
   }
}

3. VF CODE
<apex:page controller="accountcontact1">
<table>
 
  <apex:repeat value="{!accounts}" var="accWrap">
 <tr> <td>
  <apex:outputText value="User ID : {!accWrap.username}"/>
</td></tr>
   <apex:repeat value="{!accWrap.accounts}" var="acc">
<tr><td>
<apex:outputText value="Account : {!acc.Name}"/>
</td></tr>
      <apex:repeat value="{!acc.contacts}" var="cont">
<tr><td>
<apex:outputText value="Contact : {!cont.Name}"/>
</td></tr>
 
</apex:repeat>
<tr><td><hr/></td></tr>
</apex:repeat>
 
</apex:repeat>
</table>
</apex:page>
I have a few questions. Please Please HELP!!!! ASAP
1.  I am trying to develop a account search page.  The results must include the following columns account name, billing state/province, phone and website.  The code I have so far but it is not coming back with the accounts.

2.   Develop a grid of accouunt which can be selected.  Once selected and the "Show Selected Accounts" button is clicked, information from the selected accounts is displayed in the "Selected Accounts" table.  How do I do this and were do I start.  The code I have is is bringing up contacts not accounts. 

3.  Produce a page which displays Accounts and related contact using only one query.

1. CODE
<apex:page controller="theController">
   <apex:form >
      <apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection title="Search" id="search">
            <apex:pageBlockSectionItem >
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup >
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Search!" action="{!doSearch}"  rerender="block" status="status"/>
               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="Requesting..."/>
        <apex:pageBlockSection title="Results" id="results" columns="1">
           <apex:pageBlockTable value="{!results}" var="l"  rendered="{!NOT(ISNULL(results))}">
              <apex:column value="{!l.name}"/>
              <apex:column value="{!l.email}"/>
              <apex:column value="{!l.phone}"/>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>

2.  CODE 
<apex:page controller="wrapperClassController1">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Selected Accounts" action="{!processSelected}" rerender="table"/>
            </apex:pageBlockButtons>
            <!-- In our table we are displaying the cContact records -->
            <apex:pageBlockTable value="{!contacts}" var="c" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!c.selected}"/>
                </apex:column>
                <!-- This is how we access the contact values within our cContact container/wrapper -->
                <apex:column value="{!c.con.Name}" />
                <apex:column value="{!c.con.Email}" />
                <apex:column value="{!c.con.Phone}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

3.  CODE  APEX

public class accountcontact1
{
    list<AccountWrapper> wraplist=new list<AccountWrapper>();
    public accountcontact1()
    {
       Map<Id, AccountWrapper> accMap=new Map<Id, AccountWrapper>();
       for(account a:[SELECT createdby.name,CreatedbyID,Account.Name,(SELECT      
                name,Contact.FirstName, Contact.LastName 
                FROM Account.Contacts) FROM Account])
       {
     AccountWrapper accWrap=accMap.get(a.CreatedBy.name);  
          // AccountWrapper accWrap=accMap.get(a.CreatedBy.name);
           if (null==accWrap)
           {
              accWrap=new AccountWrapper();
              accMap.put(a.CreatedByname, accWrap);
              accWrap.userid=a.CreatedByid;
           
             // accMap.put(a.CreatedBy.name, accWrap);
              accWrap.username=a.CreatedBy.name;
           }
           accWrap.accounts.add(a);
       }
       wrapList=accMap.values();
   }
   public list<AccountWrapper> getaccounts()
   {
      return wraplist;
   }
   public class AccountWrapper
   {
  public id userid {get; set;} 
      public string username {get; set;}
      public List<Account> accounts {get; set;}
      public AccountWrapper()
      {
         accounts=new List<Account>();
      }
   }
}

3. VF CODE
<apex:page controller="accountcontact1">
<table>
 
  <apex:repeat value="{!accounts}" var="accWrap">
 <tr> <td>
  <apex:outputText value="User ID : {!accWrap.username}"/>
</td></tr>
   <apex:repeat value="{!accWrap.accounts}" var="acc">
<tr><td>
<apex:outputText value="Account : {!acc.Name}"/>
</td></tr>
      <apex:repeat value="{!acc.contacts}" var="cont">
<tr><td>
<apex:outputText value="Contact : {!cont.Name}"/>
</td></tr>
 
</apex:repeat>
<tr><td><hr/></td></tr>
</apex:repeat>
 
</apex:repeat>
</table>
</apex:page>
Hi Everybody,

I am new to salesforce security just wanted to have understanding on Sharing rules i have below doubt 
a) Suppose we have CEO Role at highest level and Recruitment Manager at lowest level of CEO and CEO have all object access what Recuritment manger Have and for all object Grant Access Using Hierarchies in org default is selcted my doubt is whether the record will be accesible to CEO what Recruitment Manager created or do we need to create sharing rules ?
b) What is the sharing rule and Manual Sharing Rule ?