Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (Integer i = 0; i < Info.AgentInfoList; i++)
- {
- if (Info.AgentInfoList.PriorityNumber == 0)
- {
- return Info.AgentInfoList.PriorityNumber;
- }
- //https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_json_jsonparser.htm
- public class WSController {
- public JSON2Apex info { get; set; }
- String jsonStr = '{"DateModifiedUtc":"2016-09-07T20:12:47.1519119Z",' +
- '"AgentInfoList":[{"Username":"Agent00@gmail.com","PriorityNumber":0}, ' +
- '{"Username":"Agent01@gmail.com","PriorityNumber":0},{"Username":"Agent02@gmail.com","PriorityNumber":0},' +
- '{"Username":"Agent03@gmail.com","PriorityNumber":0},{"Username":"Agent04@gmail.com","PriorityNumber":0},' +
- '{"Username":"Agent05@gmail.com","PriorityNumber":0},{"Username":"Agent06@gmail.com","PriorityNumber":0},' +
- '{"Username":"Agent11@gmail.com","PriorityNumber":2}]}';
- //wrapper class
- public class JSON2Apex
- {
- public String DateModifiedUtc { get; set; }
- public List<AgentInfoList> AgentInfoList { get; set; }
- }
- public class AgentInfoList
- {
- public String Username { get; set; }
- public String PriorityNumber { get; set; }
- }
- public static JSON2Apex parse(String json)
- {
- return (JSON2Apex) System.JSON.deserialize(json, JSON2Apex.class);
- }
- public WSController()
- {
- info = (JSON2Apex)parse(jsonStr);
- }
- public void priorityFilter()
- {
- //loop through the info.AgentInfoList and pull out all of the records with a Priority number of 0.
- for (Integer i = 0; i < Info.AgentInfoList + 1; i++)
- {
- if (Info.AgentInfoList.PriorityNumber == 0)
- {
- return AgentInfoList.PriorityNumber;
- }
- }
- }
- }
- <apex:page controller="WSController" >
- <!--TO DO:: if Priority Number changes, put a <hr/> break-->
- <style type="text/css">
- p { font-style: italic; }
- </style>
- <h1>Agent Call Distribution</h1>
- <br/>
- <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>
- <p>List last updated: {!info.DateModifiedUtc}</p>
- <br/>
- <apex:pageBlock >
- <apex:pageBlockTable value="{!info.AgentInfoList}" var="AgentInfo">
- <apex:column headerValue="Priority">
- <!--apex:outputtext value="!IF(info.AgentInfoList.PriorityNumber == '0', '0', ''))}"/-->
- <apex:outputField value="{!AgentInfo.priorityNumber}"/>
- </apex:column>
- <apex:column headerValue="Agent Email">
- <apex:outputText value="{!AgentInfo.Username}" />
- </apex:column>
- </apex:pageBlockTable>
- </apex:pageBlock>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement