Advertisement
Guest User

Untitled

a guest
Sep 12th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. for (Integer i = 0; i < Info.AgentInfoList; i++)
  2. {
  3. if (Info.AgentInfoList.PriorityNumber == 0)
  4. {
  5. return Info.AgentInfoList.PriorityNumber;
  6. }
  7.  
  8. //https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_json_jsonparser.htm
  9. public class WSController {
  10. public JSON2Apex info { get; set; }
  11.  
  12.  
  13. String jsonStr = '{"DateModifiedUtc":"2016-09-07T20:12:47.1519119Z",' +
  14. '"AgentInfoList":[{"Username":"Agent00@gmail.com","PriorityNumber":0}, ' +
  15. '{"Username":"Agent01@gmail.com","PriorityNumber":0},{"Username":"Agent02@gmail.com","PriorityNumber":0},' +
  16. '{"Username":"Agent03@gmail.com","PriorityNumber":0},{"Username":"Agent04@gmail.com","PriorityNumber":0},' +
  17. '{"Username":"Agent05@gmail.com","PriorityNumber":0},{"Username":"Agent06@gmail.com","PriorityNumber":0},' +
  18. '{"Username":"Agent11@gmail.com","PriorityNumber":2}]}';
  19.  
  20.  
  21. //wrapper class
  22. public class JSON2Apex
  23. {
  24. public String DateModifiedUtc { get; set; }
  25. public List<AgentInfoList> AgentInfoList { get; set; }
  26. }
  27. public class AgentInfoList
  28. {
  29. public String Username { get; set; }
  30. public String PriorityNumber { get; set; }
  31. }
  32. public static JSON2Apex parse(String json)
  33. {
  34. return (JSON2Apex) System.JSON.deserialize(json, JSON2Apex.class);
  35. }
  36.  
  37. public WSController()
  38. {
  39. info = (JSON2Apex)parse(jsonStr);
  40.  
  41. }
  42.  
  43. public void priorityFilter()
  44. {
  45. //loop through the info.AgentInfoList and pull out all of the records with a Priority number of 0.
  46. for (Integer i = 0; i < Info.AgentInfoList + 1; i++)
  47. {
  48. if (Info.AgentInfoList.PriorityNumber == 0)
  49. {
  50. return AgentInfoList.PriorityNumber;
  51.  
  52. }
  53. }
  54. }
  55. }
  56.  
  57. <apex:page controller="WSController" >
  58. <!--TO DO:: if Priority Number changes, put a <hr/> break-->
  59.  
  60. <style type="text/css">
  61. p { font-style: italic; }
  62. </style>
  63.  
  64.  
  65. <h1>Agent Call Distribution</h1>
  66. <br/>
  67. <p>Below is the current priority that Five9 will attempt to distribute new inbound phone mail leads. Loan Specialists high on the list are more likely to be offered a new sales call.</p>
  68. <p>List last updated: {!info.DateModifiedUtc}</p>
  69. <br/>
  70.  
  71. <apex:pageBlock >
  72. <apex:pageBlockTable value="{!info.AgentInfoList}" var="AgentInfo">
  73. <apex:column headerValue="Priority">
  74. <!--apex:outputtext value="!IF(info.AgentInfoList.PriorityNumber == '0', '0', ''))}"/-->
  75. <apex:outputField value="{!AgentInfo.priorityNumber}"/>
  76. </apex:column>
  77. <apex:column headerValue="Agent Email">
  78. <apex:outputText value="{!AgentInfo.Username}" />
  79. </apex:column>
  80. </apex:pageBlockTable>
  81. </apex:pageBlock>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement