Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. public AccountTypeController()
  2. {
  3. filterAccount = new Account();
  4. recordList = new Account[0];
  5. }
  6. public List<Account> getAccs()
  7. {
  8. List<Account> results = Database.query(
  9. 'SELECT Name, Type, Website, BillingCity, BillingStreet, BillingState, BillingPostalcode, BillingCountry, Industry ' +
  10. 'FROM Account '
  11. );
  12. return results;
  13. }
  14. public List<SelectOption> Accounts()
  15. {
  16. List<SelectOption> AccountList = new List<SelectOption>();
  17. for(Account act: [SELECT Name, Type, Website, BillingAddress, Industry FROM Account])
  18. AccountList.add(new SelectOption(act.Name, act.Name));
  19.  
  20. return AccountList;
  21.  
  22. }
  23. public void updateRecordList()
  24. { //this i'm thinking needs to be a pageReference to list the updatedAccounts //but im not sure how to change this
  25. recordList=[Select Name, Type, Website From Account Where Type = :filterAccount.Type];
  26. }
  27. public pageReference edit()
  28. { //pretty sure this is incorrect
  29. String contactId = Apexpages.currentpage().getParameters().get('AccountId');
  30.  
  31. pageReference pageRef = new pageReference(URL.getSalesforceBaseUrl().toExternalForm() + '/' + AccountId + '/e?retURL=' + account.id);
  32.  
  33. return pageRef;
  34. }
  35.  
  36. <apex:form >
  37.  
  38. <apex:outputPanel styleClass="requiredInput" layout="block" id="pwPanel">
  39.  
  40. <apex:pageBlock title="Filter Accounts" id="pb" mode="edit">
  41.  
  42. <apex:pageBlockSection >
  43.  
  44. <apex:inputfield value="{!filterAccount.Type}" label="Account Type">
  45.  
  46. <apex:actionSupport event="onchange" action="{!updateRecordList}" rerender="pwPanel"/>
  47.  
  48. </apex:inputfield>
  49.  
  50. <!--<apex:commandButton action="{!edit}" value="Edit"/>
  51. <apex:commandButton action="{!save}" value="Save"/>-->
  52.  
  53. </apex:pageBlockSection>
  54.  
  55. </apex:pageBlock>
  56.  
  57. </apex:outputPanel>
  58.  
  59. </apex:form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement