• Carter85
  • NEWBIE
  • 110 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 47
    Questions
  • 70
    Replies
Fairly new to visualforce charting with dynamic data, and I'm running into an issue regarding getting multiple charts on the same page to display.  At the moment only one is.  It's a little frustrating, as I'm guessing I'm missing something fairly simple.

Here's my controller code for the chart that is displaying:
public List<Data> getData() {
        return CM_MCMReport.getChartData(monthCurr, monthCurrm1, monthCurrm2, monthCurrm3, monthCurrm4, monthCurrm5, monthMsgsSnt, monthm1MsgsSnt, monthm2MsgsSnt, monthm3MsgsSnt, monthm4MsgsSnt, monthm5MsgsSnt, monthm5MsgsOpnd, monthm4MsgsOpnd, monthm3MsgsOpnd, monthm2MsgsOpnd, monthm1MsgsOpnd, monthMsgsOpnd, monthCurrClicks, monthCurrm1Clicks, monthCurrm2Clicks, monthCurrm3Clicks, monthCurrm4Clicks, monthCurrm5Clicks);
    	}
    
    @RemoteAction
    public static List<Data> getRemoteData(string monthCurr, string monthCurrm1, string monthCurrm2, string monthCurrm3, string monthCurrm4, string monthCurrm5, integer monthMsgsSnt, integer monthm1MsgsSnt, integer monthm2MsgsSnt, integer monthm3MsgsSnt, integer monthm4MsgsSnt, integer monthm5MsgsSnt, integer monthm5MsgsOpnd, integer monthm4MsgsOpnd, integer monthm3MsgsOpnd, integer monthm2MsgsOpnd, integer monthm1MsgsOpnd, integer monthMsgsOpnd,integer monthCurrClicks, integer monthCurrm1Clicks, integer monthCurrm2Clicks, integer monthCurrm3Clicks, integer monthCurrm4Clicks, integer monthCurrm5Clicks) {
        return CM_MCMReport.getChartData(monthCurr, monthCurrm1, monthCurrm2, monthCurrm3, monthCurrm4, monthCurrm5, monthMsgsSnt, monthm1MsgsSnt, monthm2MsgsSnt, monthm3MsgsSnt, monthm4MsgsSnt, monthm5MsgsSnt, monthm5MsgsOpnd, monthm4MsgsOpnd, monthm3MsgsOpnd, monthm2MsgsOpnd, monthm1MsgsOpnd, monthMsgsOpnd, monthCurrClicks, monthCurrm1Clicks, monthCurrm2Clicks, monthCurrm3Clicks, monthCurrm4Clicks, monthCurrm5Clicks);
    	}

    public static List<Data> getChartData(string monthCurr, string monthCurrm1, string monthCurrm2, string monthCurrm3, string monthCurrm4, string monthCurrm5, integer monthMsgsSnt, integer monthm1MsgsSnt, integer monthm2MsgsSnt, integer monthm3MsgsSnt, integer monthm4MsgsSnt, integer monthm5MsgsSnt, integer monthm5MsgsOpnd, integer monthm4MsgsOpnd, integer monthm3MsgsOpnd, integer monthm2MsgsOpnd, integer monthm1MsgsOpnd, integer monthMsgsOpnd, integer monthCurrClicks, integer monthCurrm1Clicks, integer monthCurrm2Clicks, integer monthCurrm3Clicks, integer monthCurrm4Clicks, integer monthCurrm5Clicks) {
        List<Data> data = new List<Data>();
        data.add(new Data(monthCurrm5, monthm5MsgsSnt, monthm5MsgsOpnd, monthCurrm5Clicks));
        data.add(new Data(monthCurrm4, monthm4MsgsSnt, monthm4MsgsOpnd, monthCurrm4Clicks));
        data.add(new Data(monthCurrm3, monthm3MsgsSnt, monthm3MsgsOpnd, monthCurrm3Clicks));
        data.add(new Data(monthCurrm2, monthm2MsgsSnt, monthm2MsgsOpnd, monthCurrm2Clicks));
        data.add(new Data(monthCurrm1, monthm1MsgsSnt, monthm1MsgsOpnd, monthCurrm1Clicks));
        data.add(new Data(monthCurr, monthMsgsSnt, monthMsgsOpnd, monthCurrClicks));
        return data;
    	}
    
    public class Data{
        public String name {get;set;}
        public Integer Sent {get;set;}
        public Integer Opened {get;set;}
        public Integer Clicks {get;set;}
        public Data(String name, Integer data1, integer data2, integer data3) {
            this.name = name;
            this.Sent = data1;
            this.Opened = data2;
            this.Clicks = data3;
        	}
    }
And the visualforce snippet displaying it:
<apex:chart height="400" width="700" data="{!data}">
    	  <apex:axis type="Numeric" position="left" fields="Sent,Opened,Clicks" 
            title="Messages Sent" grid="true"/>
    	  <apex:axis type="Category" position="bottom" fields="name" 
            title="Month">
    	  </apex:axis>
    	  <apex:lineSeries axis="left" xField="name" yField="Sent"
        	  markerType="circle" markerSize="4" markerFill="#3fae3f"/>
    	  <apex:lineSeries axis="left" xField="name" yField="Opened" 
            markerType="circle" markerSize="4" markerFill="#3f63ae"/>
          <apex:lineSeries axis="left" xField="name" yField="Clicks" 
            markerType="circle" markerSize="4" markerFill="#000000"/>
            <apex:legend position="right"/>  
    </apex:chart>
Now, regarding the second, problematic chart, this is the controller snippet:
public List<Chart> getData1(integer monthCurrCons, integer monthCurrm1Cons, integer monthCurrm2Cons, integer monthCurrm3Cons, integer monthCurrm4Cons, integer monthCurrm5Cons, string monthCurr, string monthCurrm1, string monthCurrm2, string monthCurrm3, string monthCurrm4, string monthCurrm5, integer monthcurrm5ConsTot, integer monthcurrm4ConsTot, integer monthcurrm3ConsTot, integer monthcurrm2ConsTot, integer monthcurrm1ConsTot, integer monthcurrConsTot) {
        return CM_MCMReport.getChartData1(monthCurrCons, monthCurrm1Cons, monthCurrm2Cons, monthCurrm3Cons, monthCurrm4Cons, monthCurrm5Cons, monthCurr, monthCurrm1, monthCurrm2, monthCurrm3, monthCurrm4, monthCurrm5, monthcurrm5ConsTot, monthcurrm4ConsTot, monthcurrm3ConsTot, monthcurrm2ConsTot, monthcurrm1ConsTot, monthcurrConsTot);
    	}
    
    @RemoteAction
    public static List<Chart> getRemoteData(integer monthCurrCons, integer monthCurrm1Cons, integer monthCurrm2Cons, integer monthCurrm3Cons, integer monthCurrm4Cons, integer monthCurrm5Cons, string monthCurr, string monthCurrm1, string monthCurrm2, string monthCurrm3, string monthCurrm4, string monthCurrm5, integer monthcurrm5ConsTot, integer monthcurrm4ConsTot, integer monthcurrm3ConsTot, integer monthcurrm2ConsTot, integer monthcurrm1ConsTot, integer monthcurrConsTot) {
        return CM_MCMReport.getChartData1(monthCurrCons, monthCurrm1Cons, monthCurrm2Cons, monthCurrm3Cons, monthCurrm4Cons, monthCurrm5Cons, monthCurr, monthCurrm1, monthCurrm2, monthCurrm3, monthCurrm4, monthCurrm5, monthcurrm5ConsTot, monthcurrm4ConsTot, monthcurrm3ConsTot, monthcurrm2ConsTot, monthcurrm1ConsTot, monthcurrConsTot);
    	}

     public static List<Chart> getChartData1(integer monthCurrCons, integer monthCurrm1Cons, integer monthCurrm2Cons, integer monthCurrm3Cons, integer monthCurrm4Cons, integer monthCurrm5Cons, string monthCurr, string monthCurrm1, string monthCurrm2, string monthCurrm3, string monthCurrm4, string monthCurrm5, integer monthcurrm5ConsTot, integer monthcurrm4ConsTot, integer monthcurrm3ConsTot, integer monthcurrm2ConsTot, integer monthcurrm1ConsTot, integer monthcurrConsTot) {
        List<Chart> charts = new List<Chart>();
        charts.add(new Chart(monthCurrm5, monthCurrm5Cons, monthcurrm5ConsTot));
        charts.add(new Chart(monthCurrm4, monthCurrm4Cons, monthcurrm1ConsTot));
        charts.add(new Chart(monthCurrm3, monthCurrm3Cons, monthcurrm1ConsTot));
        charts.add(new Chart(monthCurrm2, monthCurrm2Cons, monthcurrm1ConsTot));
        charts.add(new Chart(monthCurrm1, monthCurrm1Cons, monthcurrm1ConsTot));
        charts.add(new Chart(monthCurr, monthCurrCons, monthcurrConsTot));
        return charts;
    	}
    
    public class Chart{
        public String name {get;set;}
        public Integer Installed {get;set;}
        public Integer notInstalled {get;set;}
        public Chart(String name, Integer data1, integer data2) {
            this.name = name;
            this.Installed = data1;
            this.notInstalled = data2;
            }
    }
And the visualforce:
<apex:chart height="400" width="700" animate="true" data="{!charts}">
    	<apex:legend position="right"/>
    	<apex:axis type="Numeric" position="left" fields="Installed, notInstalled" 
        	title="Customers" grid="true">
        <apex:chartLabel />
    	</apex:axis>
    	<apex:axis type="Category" position="bottom" fields="name" title="Month">
        	<apex:chartLabel rotate="315"/>
    	</apex:axis>
    	<apex:areaSeries axis="left" xField="name" tips="true" 
        	yField="installed,notInstalled" title="Installed, Did Not Install"  />
	</apex:chart>
The issue I'm getting at the moment is that for some reason the page cannot access the 'charts' variable, claiming it's an unknow property of the standard controller, but I didn't have to make any changes to get the 'data' chart to display from my custom controller, so I'm sort of scratching my head at the moment and any help would be appreciated.



 
I'm working on trying to integrate functionality with the Edmunds API and I'm having trouble getting the exact values I want from the JSON response.  My code so far is this:
public with sharing class CM_VINDecode {

	private static final String URLprefix = 'https://api.edmunds.com/api/vehicle/v2/vins/';
	private static final String URLend = '?fmt=json&api_key=7cmw35tvwf9sj5qqsbk88nhg';    
	
	private static final String ULRStylePrefix = 'https://api.edmunds.com/api/vehicle/v2/styles/';
	private static final String URLStyleEnd = '/equipment?availability=standard&equipmentType=OTHER&fmt=json&api_key=7cmw35tvwf9sj5qqsbk88nhg';
	
	public string url	{get;set;}
	public string url2	{get;set;}
	public string vin	{get;set;}
	public string trim	{get;set;}
	public string styleID	{get;set;}
	public List<String> features	{get;set;}
	
	private static final String ELEMENT_MAKE = 'name';
    private static final String ELEMENT_MODEL = 'model';
    	
  	public void setVin(){
  		features = new list<String>();
  		url = URLprefix + vin + URLend;
  		getCalloutResponseContents(url);
  		}
  
  
  	// Pass in the endpoint to be used using the string url
	public String getCalloutResponseContents(String url) {
		// Instantiate a new HTTP request
    	Http h = new Http();
    	HttpRequest req = new HttpRequest();
    	req.setEndpoint(url);
    	req.setMethod('GET');

    	// Send the request, and parse response
    	HttpResponse res = h.send(req);
    	system.debug('Response: ' + res.getBody());
    	
		JSONParser parser = JSON.createParser(res.getBody());
    	
    	while (parser.nextToken() != null) {
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'trim')) {
                // Get the value.
                parser.nextToken();
                trim = parser.getText();
            	system.debug('Trim: ' + trim);
            	}
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'styles')) {
               	parser.nextToken();
               	parser.nextToken();
               	parser.nextToken();
               	parser.nextToken();
               	styleID = parser.getText();
                system.debug('StyleID: ' + styleID);
                }    
                }
        
        url2 = ULRStylePrefix + styleID + URLStyleEnd;
        	
        getStyle(url2);
		return null;
		}
		
	public String getStyle(String url2) {
		// Instantiate request
    	Http h = new Http();
    	HttpRequest req2 = new HttpRequest();
    	req2.setEndpoint(url2);
    	req2.setMethod('GET');
		
		// Send the request, and parse response
    	HttpResponse res2 = h.send(req2);
    	system.debug('Response: ' + res2.getBody());
    	
    	string jsonString = res2.getBody();
    	
    	Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(jsonString);
    	List<Object> e = (List<Object>)m.get('equipment');
    	
    	system.debug('Equipment: ' + e);
    	set<string> clr = new set<string>();
    	for(integer i = 0; i < m.size(); i++){
    	Map<String,Object> m2 = (Map<String,Object>)e[i];
    	    system.debug('M2' + m2);
    	    for(Object c : m2.values()){
    			string b =  string.valueOf(m2.get('name'));
    			features.add(b);
    			}
    		}
    		clr.addAll(features);
    		features.clear();
    		features.addAll(clr);
    	
    	   system.debug('Features: ' + features); 	
    	return null;
		}
		
	public class Equipment {
		public String id;
		public String name;
		public String equipmentType;
		public String availability;
		public List<Attributes> attributes;
		}

	public List<Equipment> equipment;
	public Integer equipmentCount;

	public class Attributes {
		public String name;
		public String value;
	}
	
	public static CM_VINDecode parse(String json) {
		system.debug('Result: ' + (CM_VINDecode) System.JSON.deserialize(json, CM_VINDecode.class));
		return (CM_VINDecode) System.JSON.deserialize(json, CM_VINDecode.class);
	}	
	
}
And this is the response JSON I've been working with:
{"equipment":[{"id":"20072640525","name":"Cargo Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cargo Capacity, All Seats In Place","value":"34.1"},{"name":"Cargo Capacity, Rear Seat Down Or Removed","value":"65.4"},{"name":"Max Cargo Capacity","value":"65.4"}]},{"id":"20072640526","name":"Mobile Connectivity","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Satellite Communications","value":"MAZDA CONNECT"},{"name":"Bluetooth","value":"Bluetooth"}]},{"id":"20072640528","name":"Instrumentation","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"External Temperature Gauge","value":"external temperature display"},{"name":"Tire Pressure Monitoring System","value":"tire pressure monitoring"},{"name":"Tachometer","value":"tachometer"},{"name":"Trip Computer","value":"trip computer"},{"name":"Clock","value":"clock"}]},{"id":"20072640529","name":"Misc. Exterior Features","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Rear Spoiler","value":"rear spoiler"},{"name":"Exterior Camera","value":"rear view camera"}]},{"id":"20072640530","name":"Doors","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Liftgate Window","value":"fixed"},{"name":"Rear Door Type","value":"liftgate"},{"name":"Number Of Doors","value":"4"}]},{"id":"20072640531","name":"Exterior Lights","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Fog Lights","value":"front fog/driving lights"},{"name":"Headlights Auto Delay","value":"auto delay off"},{"name":"Daytime Running Lights","value":"daytime running lights"},{"name":"Headlights Dusk Sensor","value":"dusk sensing"}]},{"id":"20072640534","name":"Front Passenger Seat","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Height Adjustable Passenger Seat","value":"height adjustable"},{"name":"Number Of Passenger Seat Manual Adjustments","value":"6"},{"name":"Heated Passenger Seat","value":"multi-level heating"}]},{"id":"20072640536","name":"Steering","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Power Steering","value":"electric power steering"}]},{"id":"20072640537","name":"1st Row Seats","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"1st Row Seat Type","value":"bucket"},{"name":"Adjustable Seat Headrest","value":"height adjustable headrests"},{"name":"1st Row Upholstery","value":"leather"},{"name":"Number Of 1st Row Headrests","value":"2"},{"name":"Seat Whiplash Protection","value":"whiplash protection system"}]},{"id":"20072640538","name":"Interior Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"2nd Row Leg Room","value":"39.3"},{"name":"1st Row Hip Room","value":"55.2"},{"name":"2nd Row Shoulder Room","value":"55.5"},{"name":"1st Row Head Room","value":"39.0"},{"name":"1st Row Leg Room","value":"41.0"},{"name":"2nd Row Head Room","value":"39.0"},{"name":"2nd Row Hip Room","value":"53.7"},{"name":"Epa Interior Volume","value":"136.4"},{"name":"1st Row Shoulder Room","value":"57.5"}]},{"id":"20072640539","name":"Spare Tire/Wheel","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Spare Tire Mount Location","value":"inside"},{"name":"Spare Tire Size","value":"temporary"}]},{"id":"20072640541","name":"Power Outlets","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Power Outlet(s)","value":"12V"}]},{"id":"20072640543","name":"Exterior Dimensions","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Overall Width Without Mirrors","value":"72.4"},{"name":"Wheelbase","value":"106.3"},{"name":"Minimum Ground Clearance","value":"8.5"},{"name":"Overall Length","value":"179.3"},{"name":"Overall Height","value":"67.3"}]},{"id":"20072640544","name":"Windows","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Privacy Glass","value":"privacy glass"},{"name":"Rain Sensing Front Wipers","value":"rain sensing"},{"name":"One Touch Windows","value":"1"},{"name":"Power Windows","value":"power windows"},{"name":"Rear Wiper","value":"intermittent rear wiper"},{"name":"Intermittent Front Wipers","value":"variable intermittent"},{"name":"Rear Defogger","value":"rear defogger"}]},{"id":"20072640545","name":"Steering Wheel","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Steering Wheel Adjustments","value":"tilt and telescopic"},{"name":"Cruise Controls On Steering Wheel","value":"cruise controls"},{"name":"Steering Wheel Trim","value":"leather and simulated alloy"},{"name":"Audio Controls On Steering Wheel","value":"audio controls"},{"name":"Phone Controls On Steering Wheel","value":"phone controls on steering wheel"}]},{"id":"20072640548","name":"Storage","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cupholders Location","value":"front and rear"},{"name":"Seatback Storage","value":"front seatback storage"},{"name":"Door Pockets Location","value":"front and rear"},{"name":"Overhead Console","value":"overhead console with storage"},{"name":"Center Console","value":"front console with storage"}]},{"id":"20072640549","name":"Sunroof","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"One Touch Power Sunroof","value":"one-touch power sunroof"},{"name":"Sunroof","value":"power glass"}]},{"id":"20072640550","name":"Seating Configuration","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"1st Row Seating Capacity","value":"2"},{"name":"2nd Row Seating Capacity","value":"3"}]},{"id":"20072640551","name":"Air Conditioning","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Air Conditioning Zones","value":"dual"},{"name":"Front Air Conditioning","value":"automatic climate control"},{"name":"Rear Heat","value":"rear ventilation ducts"},{"name":"Air Filtration","value":"interior air filtration"}]},{"id":"20072640552","name":"Differential","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Final Drive Ratio","value":"4.62"},{"name":"Limited Slip Center Differential","value":"limited slip center differential"}]},{"id":"20072640553","name":"Seatbelts","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"2nd Row Center Seatbelt","value":"3-point belt"}]},{"id":"20072640554","name":"Suspension","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Front Suspension Classification","value":"independent"},{"name":"Rear Spring Type","value":"coil springs"},{"name":"Independent Suspension","value":"four-wheel"},{"name":"Rear Suspension Classification","value":"independent"},{"name":"Front Stabilizer Bar","value":"stabilizer bar"},{"name":"Front Spring Type","value":"coil springs"},{"name":"Rear Stabilizer Bar","value":"stabilizer bar"}]},{"id":"20072640556","name":"Specifications","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Gross Vehicle Weight","value":"4566"},{"name":"Ege Highway Mpg","value":"30"},{"name":"Epa City Mpg","value":"24"},{"name":"Fuel Capacity","value":"15.3"},{"name":"Ege Combined Mpg","value":"26"},{"name":"Manufacturer 0 60mph Acceleration Time (seconds)","value":"7.8"},{"name":"Epa Highway Mpg","value":"30"},{"name":"Epa Combined Mpg","value":"26"},{"name":"Payload","value":"977"},{"name":"Curb Weight","value":"3589"},{"name":"Turning Diameter","value":"36.7"},{"name":"Tco Curb Weight","value":"3589"},{"name":"Ege City Mpg","value":"24"},{"name":"Towing Capacity","value":"2000"}]},{"id":"20072640557","name":"Brake System","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Rear Brake Type","value":"disc"},{"name":"Front Brake Type","value":"ventilated disc"},{"name":"Antilock Braking System","value":"4-wheel ABS"},{"name":"Braking Assist","value":"braking assist"}]},{"id":"20072640558","name":"Drive Type","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Driven Wheels","value":"all wheel drive"}]},{"id":"20072640559","name":"Misc. Interior Features","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Cruise Control","value":"cruise control"},{"name":"Floor Mats","value":"floor mats"},{"name":"Floor Mat Material","value":"carpet"}]},{"id":"20072640560","name":"Collision Safety System","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Accident Avoidance System","value":"blind spot warning"},{"name":"Post Collision Safety System","value":"post-collision safety system"}]},{"id":"20072640562","name":"Driver Seat","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Height Adjustable Driver Seat","value":"height adjustable"},{"name":"Driver Seat Adjustable Lumbar","value":"power adjustable lumbar support"},{"name":"Number Of Driver Seat Power Adjustments","value":"6"},{"name":"Heated Driver Seat","value":"multi-level heating"}]},{"id":"20072640563","name":"Security","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Engine Immobilizer","value":"engine immobilizer"},{"name":"Power Door Locks","value":"hands-free entry"},{"name":"Anti Theft Alarm System","value":"remote anti-theft alarm system"}]},{"id":"20072640565","name":"Airbags","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Head Airbags","value":"front and rear"},{"name":"Passenger Airbag Deactivation","value":"occupant sensing deactivation"},{"name":"Side Curtain Airbag Rollover Sensor","value":"side-curtain airbag rollover sensor"},{"name":"Side Airbags","value":"dual front"}]},{"id":"20072640566","name":"2nd Row Seats","equipmentType":"OTHER","availability":"STANDARD","attributes":[{"name":"Folding 2nd Row","value":"split folding"},{"name":"2nd Row Seat Type","value":"bench"},{"name":"Adjustable 2nd Row Headrests","value":"height adjustable headrests"},{"name":"Number Of 2nd Row Headrests","value":"3"},{"name":"2nd Row Center Armrest","value":"folding"}]}],"equipmentCount":31}
What I'd like to accomplish is to get the value of any 'name' key in the map I've created, but I can't figure out the right way to do it (first time I've tried anything like this).  Ideally I'd like to only pull in the 'name' values that also match to an 'availability' of Standard, but I'll settle for just getting all the names and trying to filter them from there.  I know what I have currently is obviously wrong as I'm only ending up with 2 items in my features list when I run it, when it should be more like 31, but that configuration was the only way I was able to pull anything close to what I'm looking for.  Any help would be greatly appreciated as I've been banging my head against this longer than I'd care to admit today.

Thanks
I have having difficulty getting the index of a list item contained within the <apex:map> tag
I am trying to access the index of a list contained within the map tag on my VF page to pass to a resource call in order to assign custom map markers to each line item because we want more varied markers than the standard.  My VF snippet it thus:
<apex:pageBlockSection title="Service Area For {!companyName}">
  <apex:map width="1300px" height="600px" mapType="roadmap" center="{!mapCenter}">
    <apex:repeat value="{!locations}" var="apt">
    
    <apex:mapMarker title="{!apt.item.Subject}" position="{!apt.item.loc}" icon="{!URLFOR($Resource.GoogleMarkers, + '.png')}">
    	<apex:mapInfoWindow >
            <apex:outputPanel layout="block" style="font-weight: bold;">
              <apex:outputText >{!apt.item.Subject}</apex:outputText>
            </apex:outputPanel>
            <apex:outputPanel layout="block">
              <apex:outputText >{!apt.item.loc}</apex:outputText>
            </apex:outputPanel>               
			<apex:outputPanel layout="block">
                  <apex:outputText >{!apt.item.ServiceTime}</apex:outputText>
              </apex:outputPanel>               
    	</apex:mapInfoWindow>
    </apex:mapMarker>
    </apex:repeat>
   </apex:map>


And my apex snippet controlling it is here:
public PageReference specificDate(){
		try{
			dte = date.parse(dteInput);
			}
		catch(Exception E){
			ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Date formatted incorrectly.  Check entry and try again.'));
			}	
		locations = new list<mapWrapper>();
		names = new Map<String, String>();
		integer i = 0;
		integer counter = 1;
		for(Event evnt: [SELECT Id,
           							Subject,
           							Location,
           							Service_Time__c,
           							StartDateTime
           							FROM Event
           							WHERE OwnerID IN: users
           							AND RecordType.ID = '01213000001CDUu'
           							AND ActivityDate =: dte
           							ORDER BY StartDateTime ASC]){
                
               	names.put(evnt.Subject + ': ' + evnt.Service_Time__c,evnt.Location);
                
                mapEvent myMap = new mapEvent();
                myMap.Subject = evnt.subject;
                myMap.ServiceTime = evnt.Service_Time__c;
                myMap.loc = evnt.Location;
                myMap.icon = i;
                //locations.add(myMap);
                locations.add(new mapWrapper(myMap, counter));
                counter = counter + 1;
                i++;
				}
		//if(locations.size() > 0){		
	//		mapCenter = locations[0].loc;	 	
	//		}
	//	else{
			mapCenter = companyAddr;
		//	}	
		return null;	
		}
		
	class mapWrapper {
  		public Integer counter {get;set;}
  		public mapEvent item { get; set;}
  		public mapWrapper(mapEvent item, Integer counter) {
    		this.item = item;
    		this.counter = counter;
  			}
		}

All I really want to do is to pass the index to the icon parameter here:
<apex:mapMarker title="{!apt.item.Subject}" position="{!apt.item.loc}" icon="{!URLFOR($Resource.GoogleMarkers,!apt.counter+'.png')}">
I've tried just using apex:variable or apex:param but apparently they're prohibited from use anywhere within the map markup. 
This is how far I've gotten to try and bypass that.  However, when I try to save I get this error: "Incorrect parameter type for function 'not()'. Expected Boolean, received Number" so I'm a bit stuck on how I could go about getting past assigning the counter value so it doesn't think I'm trying to do a comparison function, because any other way to try to save it gives me a syntax error, so any suggestions would be appreciated, or if anyone knows of a simpler way to do it overall in order to individually style each map marker and can point me in the right direction that would be great.
I'm working in our sandbox currently on this method:
public PageReference proceed(){
        DEALER = true;
        if((vin != null && vin != '')){
            if(vin.containswhitespace()){
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Your VIN # entry contains a blank space, which may happen during copy and pasting from a different source, please check entry and try again.'));
                return null;
                }
            qry = 'SELECT ID, Vin_Number__c, Insurer__r.Name, Contract_Status__c, Vehicle_Make__c, Vehicle_Model__c, Vehicle_Year__c, Name, Benefits_Options__c, Batch__r.Product_Group_Name__c, Policy_Type__c, Contract_Number__c, Term__c, Class__c, Effective_Date__c, Expiration_Date__c FROM MG_Contract_Holder__c WHERE (Vin_Number__c =:vin) AND Batch__r.Product_Group__r.Service_Contract__c = false';    
            searchCreate();
        if(contractList.size() > 0){
            CONS = true;
            searchHistory();
            RETURNDEALER = false;
            return page.CM_WebClaimStep1;
            }
        else{
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'No contract found matching the information you entered, check entry and try again.'));
            return null;    
            }
            }
        else{
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Please make sure the VIN Number field is filled in before searching.'));
            return null;
            }
            return null;
            }

public void searchCreate(){
        contractList = new List<ContractWrapper>();
            for(MG_Contract_Holder__c c : database.query(qry)){
                    if(c.Insurer__r.Name == 'NSD'){
                        NSD = true;
                        }
                    contractList.add(new contractWrapper(c));
                    }
                }
And I keep getting this error message when I execute the search: Collection size 2,327 exceeds maximum size of 1,000
I know from looking at other people's posts who have dealt with this error message is that it means I'm trying to populate a list on a VF page with more than 1,000 rows, except the thing is in this case I'm not trying to do that at all.  The sandbox I'm working in at the moment is only a partial data one and there is literally only one record which should be returned for this query based on the criteria.  And the whole process that this is contained in is working fine in production, I was only testing out an unrelated change which we'll be pushing out soon but I keep running up against this.  Does anyone have any thoughts on what may be causing this?
I'm new to trying to use the @InvocableMethod with the process builder and could use a little guidance as I'm not finding the salesforce examples all that helpful.
My class with the method is below:
public without sharing class CM_KeyReplacementEmailSender {
	
	private static String displayName	= 'claims@maximusautogroup.com';
	private static String replyEmail = 'claims@maximusautogroup.com';
	
	@InvocableMethod	
	public static void send(List<ID> id){
		
		List<MG_Claim_Issue__c > iss = [SELECT ID, Name, Contact_Email__c, MAG_Claim__r.Name, Customer_Name__c, Where_will_repair_occur__c FROM MG_Claim_Issue__c WHERE ID =:id];
		Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
		
		String claimNum = iss[0].MAG_Claim__r.Name;
		String issNum = iss[0].Name;
		
		String subject = 'Information regarding open claim with Maximus Auto Group # ' + claimNum;
		
    	String address = iss[0].Contact_Email__c;
    	String[] toAddress = address.split(':', 0);
    	
    	email.setSubject(subject);
		email.setToAddresses(toAddress);
    	email.setSenderDisplayName(displayName);
    	email.setReplyTo(replyEmail);
    	
    	Note note = new Note();
	 	note.Title = 'Email RE: '+ issNum + ' (' + DateTime.now() + ')';
		note.ParentId = iss[0].Id;	
			
    	if(iss[0].Where_will_repair_occur__c == 'Selling Dealer'){
               
        	// Sets the paramaters of the email
			email.setHtmlBody('<p>Test</p>');
    		
    		
			}
		else{
			// Sets the paramaters of the email
			
			email.setHtmlBody('<p>Test2</p>');
    		
			
			}
			// Sends the email
			Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); 	
			note.Body = email.plainTextBody;
			insert note;
			
			
			}

}
I've gotten it to covered with a test class, but when I try and Invoke it from a process builder condition meant to supply the id variable in a practical test I'm not seeing any results.  I'm wondering what I may be missing and would appreciate any insight.
 
I don't know why I'm spacing on the right way to do this at the moment, but I could use some help.
I have a list contained in a wrapperclass that I want to be able to update the associated values for when they change based on user interaction and then pull the new values in to update records when the user chooses to update their modifications.
 This is my class:
public with sharing class CM_BatchEditClass{

	private ID  id	{get;set;}
    
    public ID conID	{get;set;}
    
    public List<MG_Contract_Holder__c> editList	{get;set;}
    
    public List<ContractWrapper> contractList    {get;set;}
    
    public decimal fillAmt	{get;set;}
    public decimal remitUpd	{get;set;}
    	
    public CM_BatchEditClass(ApexPages.StandardController controller){
        editList = new list<MG_Contract_Holder__c>();
        contractList = new list<ContractWrapper>();
        }
	
	public class contractWrapper{
        //the contract records
        public MG_Contract_Holder__c rContract  {get;set;}
                
       	public ID conID {get;set;}
        public decimal remitUpd	{get;set;}
        /*
        *   Constructor initializes the contract reference
        */
    public contractWrapper(MG_Contract_Holder__c c){
        rContract = c;
        conID = c.ID;
        remitUpd = 0.00;
        }
        }
	
	public void initList(){
       	id = ApexPages.currentPage().getParameters().get('id');
       	
       	editList = [SELECT Full_Name__c,
       					   Contract_Number__c,
       					   Received_Date__c,
       					   Policy_Type__c,
       					   Class__c,
       					   Term__c,
       					   Benefits_Options__c,
       					   Remit_Amount__c
       					   FROM MG_Contract_Holder__c
       					   WHERE Batch__c =: id];
    					   
    	for(MG_Contract_Holder__c c : editList){
    		contractList.add(new contractWrapper(c));
    						}			
    					   	}
    
    public pageReference saveChanges(){
    	conID = Apexpages.currentPage().getParameters().get('conID');
    	remitUpd = decimal.valueof(Apexpages.currentPage().getParameters().get('newRemit'));
    	
    	system.debug('remitUpd: ' + remitUpd);
    	//MG_Contract_Holder__c toUpdate = [SELECT ID FROM MG_Contract_Holder__c WHERE ID =: conID];
    	//toUpdate.Remit_Amount__c = remitUpd;
    	
    	//update toUpdate;
    	
    	ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Contract updated.'));
    	return null;
    	}	
    
    public pageReference fillDown(){
    	for(MG_Contract_Holder__c c : editList){
    		c.Remit_Amount__c = fillAmt;
    		}
    		ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Contract(s) updated.'));
    		update editList;
    		
    		return null;
    		}

	
}
And here is the form it's interacting with:
<apex:form >   
       <apex:sectionHeader title="Contract Remittance" subtitle="Payment Application"/>              
       		<apex:pageblock >
       <apex:messages style="color:red;text-align:left;"/>              
       			<apex:outputLabel >Fill Down Amont:</apex:outputLabel>
       			<apex:inputText value="{!fillAmt}" />
       			<apex:commandButton value="Apply" action="{!fillDown}" />
       			
            		<apex:pageBlockTable value="{!contractList}" var="c">
						<apex:column headervalue="Customer Name:">
							<apex:outputField value="{!c.rContract.Full_Name__c}"/>
						</apex:column>
						<apex:column headervalue="Contract Number:" style="text-align:center">
							<apex:outputField value="{!c.rContract.Contract_Number__c}"/>
						</apex:column>
						<apex:column headervalue="Policy:" style="text-align:center">
							<apex:outputField value="{!c.rContract.Policy_Type__c}"/>
						</apex:column>
						<apex:column headervalue="Term:" style="text-align:center">
							<apex:outputField value="{!c.rContract.Term__c}"/>
						</apex:column>
						<apex:column headervalue="Class:" style="text-align:center">
							<apex:outputField value="{!c.rContract.Class__c}"/>
						</apex:column>
						<apex:column headervalue="Option:" style="text-align:center">
							<apex:outputField value="{!c.rContract.Benefits_Options__c}"/>
						</apex:column>
						<apex:column headervalue="Remit:" style="text-align:center">
							<apex:inputField value="{!c.rContract.Remit_Amount__c}"/>
						</apex:column>
						<apex:column>
						<apex:commandButton value="Save" action="{!saveChanges}" rerender="hiddenBlock">
            				<apex:param name="conID" value="{!c.rContract.ID}" assignTo="{!conID}"/>
                			<apex:param name="newRemit" value="{!c.remitUpd}" assignTo="{!remitUpd}"/>	
                		</apex:commandButton>
						</apex:column>
					</apex:pageBlockTable>
					<apex:pageBlock id="hiddenBlock" rendered="false"></apex:pageBlock>
       		</apex:pageblock>
       		 
  </apex:form>
The variable in question, at the moment, which I would like to update on the fly and have ready for when the user clicks the save button is the
{!c.remitUpd} parameter, which would contain any updated value the user has entered in the {!c.rContract.Remit_Amount__c} field and I've never done it before with a dynamic list like this so I haven't been able to work out the right means of passing the new value to the parameter so that it updates beyond the inital set value of 0.00 and therefore any help would be appreciated.
 
I'm trying to take a VF page I've created and which the user is currently viewing, convert it to a pdf on an actionbutton click and save it to an Object record, but everything I try returns the error I referenced in the subject of this thread.
My current method is this:
public pageReference savePdf(){
    		System.Pagereference currentPage = ApexPages.currentPage();
    		Attachment attach = new Attachment();
    		Blob body = currentPage.getContentAsPDF();
        	attach.Body = body;
        	attach.Name = 'RemitRegister.pdf';
        	attach.ParentId = 'a0319000000ppIf';
        	insert attach;
    		PageReference newPg = new PageReference('/apex/CM_MonthlyRemittance');
			newPg.setRedirect(true);
    		return newPg;
    		}
From what I've seen in similar instances when people have come across this it's generally caused when you try and return the same page which is currently being displayed.  However, even with any number of means of trying to redirect or return a different page this still occurs for me and is getting quite frustrating as this is the only nagging issue which is preventing the larger project from being completed.  Any help would be appreciated.
 
I'm trying to render an invoice for a user while at the same time attaching it to the applicable records in our database.
My current structure for the method is as follows:
public PageReference processSelection(){
        List<ID> batchList = new List<ID>();
                
        containerList = new List<ContractWrapper>();
        updateList = new List<MG_Contract_Holder__c>();
        MG_Contract_Holder__c updCon = new MG_Contract_Holder__c();
        if(tContractList.size() > 0){
        	containerList.addall(tContractList);
        	}
        if(twcContractList.size() > 0){
        	containerList.addall(twcContractList);
        	}
        if(gapContractList.size() > 0){
        	containerList.addall(gapContractList);
        	}
        if(mppContractList.size() > 0){
        	containerList.addall(mppContractList);
        	}
        if(wsContractList.size() > 0){
        	containerList.addall(wsContractList);
        	}
        if(upppcContractList.size() > 0){
        	containerList.addall(upppcContractList);
        	}
        if(upppContractList.size() > 0){
        	containerList.addall(upppContractList);
        	}
        if(uppContractList.size() > 0){
        	containerList.addall(uppContractList);
        	}
        if(sealContractList.size() > 0){
        	containerList.addall(sealContractList);
        	}
        if(pdrContractList.size() > 0){
        	containerList.addall(pdrContractList);
        	}
        if(mpppcContractList.size() > 0){
        	containerList.addall(mpppcContractList);
        	}
        if(mpppContractList.size() > 0){
        	containerList.addall(mpppContractList);
        	}
        if(keyContractList.size() > 0){
        	containerList.addall(keyContractList);
        	}
        if(keyplContractList.size() > 0){
        	containerList.addall(keyplContractList);
        	}
        if(etchContractList.size() > 0){
        	containerList.addall(etchContractList);
        	}
        		
        Integer selectedCount2 = 0;
		
		for(contractWrapper sub : containerList){
            if(!sub.selected){
                continue;
                }
            if(sub.selected == true){
                selectedCount2++;
                }
            if(selectedCount2 > 0){
                subNum = sub.subNum;
                subVin = sub.subVin;
                system.debug('subNum: ' + subNum);
                system.debug('subVin: ' + subVin);
                updCon = [SELECT Contract_Status__c, Batch__c FROM MG_Contract_Holder__c WHERE Contract_Number__c =:subNum AND Vin_Number__c =:subVin];
                batchList.add(updCon.Batch__c);
                system.debug('updCon');
                updCon.Contract_Status__c = 'Submitted - Pending Payment';
                updateList.add(updCon);
                }
                }
            if(selectedCount2 == 0){
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'You must select at least one record to submit before proceeding.'));
                return null;
                }
                update updateList;
                
                Set<ID> myset = new Set<ID>();
				List<ID> result = new List<ID>();
				myset.addAll(batchList);
				result.addAll(myset);
    			PageReference page = new PageReference('/apex/pages/CM_RemitReport');                
                page.setRedirect(true);
    			for(integer i = 0; i < result.size(); i++){
    				Attachment attach = new Attachment();
        			Blob body;
        			body = page.getContent();
        			attach.Body = body;
        			attach.Name = 'RemitRegister.pdf';
        			attach.ParentId = result[i];
        			insert attach;
        			}
    			return page;
                }
However, I hit an error on the line:
body = page.getContent();
which is: Exception common.page.PageInterruptException, Cyclical server-side forwards detected
and I'm having trouble resolving it.
Any suggestions would be appreciated.
Hi,  I receive the following error in a test class but have not been able to repeat them in non test running scenarios.

"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. 
A flow trigger failed to execute the flow with version ID 301O00000008hM6. 
Contact your administrator for help.: []"

Does anyone know if there could be an issue running flows in test class contexts but not otherwise?

Thanks.
I have a list encapsulated in a wrapper class and I'm trying to remove items based on user defined criteria, it this case, whether or not it has been checked off on the list.  I can't seem to find the correct syntax for processing however, I always and up with an Illegal assignment error.
My current structure is:
Integer selectedCount2 = 0;
    	for(integer i = 0; i < tContractList.size(); i++){
    	if(!tContractList[i].selected){
            tContractList = tContractList.remove(i);
            }
        if(tContractList[i].selected == true){
        	selectedCount2++;
            }
			}
The error i get is: Compilation error: Illegal assignment from CM_RemittanceClass.contractWrapper to LIST&lt;CM_RemittanceClass.contractWrapper&gt;

Basically I just want to remove any item which hasn't been selected, so if anyone has a suggestion on the easiest way to do that I would appreciate it.
 
When rendering as a PDF can I not display a dynamic grand total footer calculation in a table?
In my page I have a section like this:
<apex:pageBlock >
		  <apex:pageBlockSection title="Tire and Wheel Contracts" rendered="{!NOT(ISNULL(tcontractList))}">
          <apex:variable value="{!0.00}" var="total1"/>
          <apex:pageBlockTable value="{!tcontractList}" style="border:1px solid black;" var="c" rendered="{!NOT(ISNULL(tcontractList))}">
          <apex:column style="border:1px solid black; text-align:center; width:85px; font-weight:bold; color:blue;" id="note" value="{!c.rContract.Contract_Number__c}" headerValue="Contract #"/>
          <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Vin_Number__c}" headerValue="VIN"/>
          <apex:column style="border:1px solid black; text-align:center; width:125px" value="{!c.rContract.Name}" headerValue="Name"/>
          <apex:column style="border:1px solid black; text-align:center; width:125px; font-weight:bold; color:blue" value="{!c.rContract.Policy_Type__c}" headerValue="Policy Type"/>
          <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Term__c}" headerValue="Term"/>
          <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Class__c}" headerValue="Class"/>
          <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Benefits_Options__c}" headerValue="Option"/>
          <apex:column style="border:1px solid black; text-align:center; width:95px" value="{!c.rContract.Effective_Date__c}" headerValue="Purchase Date"/>
          <apex:column style="border:1px solid black; text-align:center; width:95px" headerValue="Dealer Cost">
          <apex:outputField value="{!c.rContract.Dealer_Cost__c}" />
          <apex:variable var="total1" value="tdueAmount" />
           	<apex:facet name="footer">
            	<span style="font-weight:bold; color:blue">Total Due: $<span class="t1"></span></span>
          	</apex:facet>
          </apex:column>
		  </apex:pageBlockTable>
          <br/>
          <script>
    			// Here we will set the generated subtotals to the footer cells
    			document.getElementsByClassName('t1')[0].innerHTML = '{!total1}';
    	  </script>
          </apex:pageBlockSection>
And the only thing which does not display is the total calculation in the footer.  I know it's operating correctly because I have this same code on the referring page where the user can then choose to create the PDF to print off which opens this new page where the figure does not show up.  Is there some sort of restriction in the renderAs PDF option which prevents this from working properly, or is there an allowance I need to make in this situation to make sure it does show up?
 
I'm trying to pull a list of record IDs currently encapsulated in a wrapperClass for use in a different method but I'm coming across an annoying error.  The method I'm trying to execute in it's current state is below:
public pageReference tapplyPay(){
    	system.debug(tcontractList);
    	
    	list<MG_Contract_Holder__c> temp = new list<MG_Contract_Holder__c>();
    	list<ID> temp2 = new list<ID>();
    	apply = tpayAmount/tcontractList.size();
    	
    	system.debug(tcontractList[0].voidID);
    	    	
    	for(integer i = 0; i <= tcontractList.size(); i++){
    		temp2.add(tcontractList[i].voidID);
    		}
    	
    	system.debug(temp2);
    	
    	temp = [SELECT ID, Contract_Status__c, Remit_Amount__c FROM MG_Contract_Holder__c WHERE ID IN:temp2];
    	    	 
        for(integer i = 0; i <= temp.size(); i++){
            	temp[i].Contract_Status__c = 'Submitted - Pending Payment';
                temp[i].Remit_Amount__c = apply;
                }        
    	
    	update(temp);
    
    	PageReference pageRef = new PageReference(ApexPages.currentPage().getUrl());
		pageRef.setRedirect(true);
		return pageRef;
    	}
Where tcontractList is encapsulated by the wrapperClass.
The error I encounter is with the line:
temp2.add(tcontractList[i].voidID);
It throws an List index out of bounds error even though with the debug statement above, system.debug(tcontractList[0].voidID);, I know there's at least one value it should be finding when I try and iterate through the tcontractList and assign the IDs to my other list.
Is there some other way to do this with wrappers that I'm missing or can anyone see my error to advise?
Any help appreciated.

 
I'm trying to finish a test class for a process which issues credentials for users and I'm a bit stuck at the moment.
This is the class:
public with sharing class CM_InfoController{

	private static String ORG_WIDE_EMAIL_ADDRESS = 'customerservice@maximusautogroup.com';

    public Contact user    {get;set;}
    public Contact oUser    {get;set;}
    public Contact nu   {get;set;}
    public UserInfo__c upd	{get;set;}
        
    private static ID orgWideEmailId = [SELECT id FROM OrgWideEmailAddress WHERE address=:ORG_WIDE_EMAIL_ADDRESS].id;

    public CM_InfoController(){
    }

    public CM_InfoController(ApexPages.StandardController controller){
        user = (Contact)controller.getRecord();
        }

    public PageReference sendEmail(){
        if(user != null){
            nu = [SELECT UserInfo__c, ID, Name, Associated_With__c, Is_Dealer__c, Is_Agent__c, Email, Password__c FROM Contact WHERE id=:user.id];
            if(nu.Email == null){
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error, 'Please make sure that the email field has a value in it before trying to issue credentials.' );
                ApexPages.addMessage(myMsg);
                return null;
                }
            if(nu.userInfo__c == null){
                try{
                    UserInfo__c newUser = new UserInfo__c();
                    newUser.Account__c = nu.Associated_With__c;
                    newUser.UserId__c = nu.Email;
                    newUser.Password__c = nu.Password__c;
                    newUser.Assigned_To__c = nu.ID;
                    newUser.Dealer__c = nu.Is_Dealer__c;
                    newUser.Agent__c = nu.Is_Agent__c;

                    insert newUser;
                    nu.UserInfo__c = newUser.id;
                    update nu;
                    }
                catch(DmlException e){
                    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error, 'This user has already been given credentials, or this email has been assigned to someone else, change the existing information from the UserInfo tab before attempting to resend if this is in error.' );
                    ApexPages.addMessage(myMsg);
                    return null;
                    }
                    buildEmail();
                    }
                else{
                    reSend();
                    }
                    }
                    return null;
                    }

            public void reSend(){
                Contact nu = [SELECT Associated_With__c, UserInfo__c, Email, Password__c FROM Contact WHERE id=:user.id];
                UserInfo__c upd = [SELECT Name FROM UserInfo__c WHERE id=:nu.UserInfo__c];
                    upd.UserId__c = nu.Email;
                    upd.Password__c = nu.Password__c;

                  update upd;
                  buildEmail();
                  }
                  
            public void buildEmail(){
                  // Build new URL
                  Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                  String htmlBody = '<h1>MAG User Info Request</h1>' +
                  '<p>Dear ' + nu.Name + ',</p>' +
                  '<p>We have received your request for user credential information in order to access some secure features of the Maximus Auto Group website based on your affiliation with ' + nu.Associated_With__c + '.</p>' +
                  '<p>Your Username is: ' + nu.Email + '</p>' +
                  '<p>Your Password is: ' + nu.Password__c + '</p>' +
                  '<p>As the password contained here is only meant to be temporary, we recommend changing it to something easier for you to remember at your earliest convenience.</p>' +
                  '<p>You may change your associated email or password from any of the secure pages on the website by pressing the change password button.</p>' +
                  '<p>You may access some of the restricted features, based on the level of access granted to you, by visiting our website and navigating to the feature in question: <br/>http://MaximusAutoGroup.com</p>' +
                  '<p>If you have any questions or concerns regarding this information, please contact one of our associates at 1-800-801-1342 and we will assist you, or reply to this email with any specific questions.</p>' +
                  '<p>Thank you for your business and continued support!</p>' +
                  '<p>MAXIMUS AUTO GROUP</p>';

                   //Build Email
                   mail.setOrgWideEmailAddressId(orgWideEmailId);
                            String[] toAddresses = new String[]{nu.Email};
                                            mail.setToAddresses(toAddresses);
                                            mail.setSubject('MAG User Access');
                                            mail.setHtmlBody(htmlBody);

                                            Messaging.sendEmail(new Messaging.Email[]{mail},true);

                                            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'Message sent successfully');
                                            ApexPages.addMessage(msg);
                }
}
And this is the test:
@isTest(SeeAllData=true)
public with sharing class CM_InfoTest {

	public static testMethod void CM_InfoTestTst(){

		Contact use = new Contact(
								  FirstName = 'Tom',
								  LastName = 'Testington',
								  Account = [Select ID, Name FROM Account WHERE Name =:'Atlantic Dealer Services'],
								  Email = ''
								  );
								  insert use;

		CM_InfoController controller = new CM_InfoController();
		controller = new CM_InfoController(new ApexPages.StandardController(use));
		controller.sendEmail();

		use.Email = 'testing@maximusautogroup.com';
		update use;

		UserInfo__c tst = new UserInfo__c(
										  Account__c = use.Account.Name,
										  Assigned_to__c = use.ID,
										  Password__c = use.Password__c,
										  UserId__c = use.Email
										  );
										  insert tst;

		controller.sendEmail();
		controller.buildEmail();
		controller.nu.UserInfo__c = tst.ID;
		system.debug(controller.nu);
		system.debug(controller.nu.UserInfo__c);
		controller.reSend();
		}

}
I'm stuck at 83% at the moment because the reSend() method keeps throwing an error when the test controller invokes it, claiming: FATAL_ERROR Class.CM_InfoController.reSend: line 57, column 1
FATAL_ERROR Class.CM_InfoTest.CM_InfoTestTst: line 34, column 1
FATAL_ERROR System.QueryException: List has no rows for assignment to SObject
And I'm puzzled because my debug statements are showing that the variable going into that query is not null and should therefore be returning a result.
If anyone has any suggestions, or a means of covering the class better than I am currently that would be appreciated.
I'm having trouble styling a multi-select list properly in my markup.  My table is as show below:
<apex:pageBlockTable value="{!component}" var="none" >
          			<apex:column headervalue="What extra features does the windshield have? (select all that apply):" style="text-align:center;">
          				<apex:inputField value="{!component.Windshield_Features__c}"/>
          			</apex:column>
          		</apex:pageBlockTable>
I simply want to increase the number of visible lines displayed to the user, as at the moment it is quite condensed.  I've made the defalut value of the field 10, but it won't reflect that here.  I've tried the style="size: 10" but that has no effect either.  The only thing which seems to work is style="height:100px".  However, that also enlarges the size of the selection buttons to the point that they look awful so I'm hoping someone knows a way to change the sizes independently because I even tried a styleClass to set the height but for some reason that only affected the button size rather than the table height.
 
I'm trying to pull a single value from a row in a table contained within a wrapper class so I can just execute a method based on that user selected item but I'm having an issue.  My VF markup for the table is as follows:
<apex:pageBlockTable value="{!pendList}" style="border:1px solid black;" var="p" rendered="{!NOT(ISNULL(pendList))}">
          		<apex:column style="border:1px solid black; text-align:center;  font-weight:bold; color:blue;" value="{!p.pIssue.Name}" headerValue="Claim Number"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px"  value="{!p.pIssue.MAG_Claim__r.Contract_Holder__r.Policy_Type__c}" headerValue="Policy Type"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px"  value="{!p.pIssue.CreatedDate}" headerValue="Date Opened"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px"  value="{!p.pIssue.RecordType.Name}" headerValue="Claim Type"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px"  value="{!p.pIssue.Damage_Type__c}" headerValue="Type of Loss"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px;  font-weight:bold; color:blue;" value="{!p.pIssue.Component_Status__c}" id="note" headerValue="Status"/>
          		<apex:column headerValue="Check/Add Attachments" style="border:1px solid black; text-align:center;" width="50px">
          			<apex:param assignTo="{!issID}" value="{!p.pIssue.ID}"/>
          			<apex:commandLink style="align:center" action="{!checkAttach}" rendered="{!p.pIssue.Component_Status__c == 'Pending'}">Check/Add</apex:commandLink>
          		</apex:column>
          	</apex:pageBlockTable>
And the method checkAttach(), which I'm trying to utilize on whichever row the user clicks the command link on looks like this so far:
public pageReference checkAttach(){
		    system.debug(issID);
		    fileList = [SELECT Name, ContentType, Description FROM Attachment WHERE Parent.ID =: issID];
    		if((!fileList.isEmpty())){
            	FOUND = true;
                this.message = null;
                return page.CM_WebClaimFileCheck;
                }
    		else{
            	this.message = 'No files attached.';
                return page.CM_WebClaimFileCheck;
                }	
              	return null;
    			}
I was hoping the <apex:param assignTo="{!issID}" value="{!p.pIssue.ID}"/> would take care of assiging that particular table item's ID to the ID variable I created, but it doesn't seem to assign the value as my debug statement claims it remains null.

Any help would be appreciated.

 
I'm working on creating a list to allow attachments to be assigned to different or multiple object records at once.  the list to add the attachements is supposed to populate spaces for files dynamicall based on user selection from a list.  I have the attachements assigning properly to their inteded records in my tests, however, the list size is not responding how I'd like.  It currently increments only one space at a time, rather than how many spaces the user selects and I'm having trouble getting it correct, so I'd appreciate any assistance.
My apex:
public with sharing class CM_MultipleAttach{

//Picklist of integer values to hold file count
    public List<SelectOption> filesCountList {get;set;}
    //Selected count
    public integer FileCount {get;set;}
    public string claimNum {get;set;}
    transient String contentType {get;set;}
transient String fileName {get;set;}
    transient Blob file {get;set;}
    public List<uploadWrapper> uploadList    {get;set;}
    public List<Attachment> allFileList {get;set;}


    public CM_MultipleAttach(ApexPages.StandardController controller){
        //Initialize
        filesCountList = new List<SelectOption>();
        FileCount = 0;
        allFileList = new List<Attachment>();
        uploadList = new List<uploadWrapper>();
        //Adding values count list - you can change this according to your need
        for(Integer i = 1; i < 3; i++){
            filesCountList.add(new SelectOption(''+i , ''+i));
         }
      }

    public class uploadWrapper{
        //the claim record(s)
        transient Attachment rClaim{get;set;}
        //Identify the claim and what necessary fields are filled in with for claim attach
        public string claimNum {get;set;}
        public Blob file {get;set;}
        public string fileName {get;set;}
        public String contentType {get; set;}
  /*
        *   Constructor initializes the reference
        */

    public uploadWrapper(List<Attachment> allFileList){
     }

     }

    public Pagereference SaveAttachments(){
        for(uploadWrapper cw : uploadList){
         if(cw.file == null){
             ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'Some claim numbers do not have associated files. Please select files for those claims.'));
          return null;
          }
            if(cw.file != null){
                claimNum = cw.claimNum;
                file = cw.file;
                MG_MAG_Claim__c attInv = [SELECT ID FROM MG_MAG_Claim__c WHERE Name =:claimNum];
                Attachment attach = new Attachment();
         attach.Body = cw.file;
         attach.Name = cw.filename;
         attach.ContentType = cw.contentType;
         attach.ParentID = attInv.ID;
      try{
          insert(attach);
         }
         catch(System.DMLException e){
          ApexPages.addMessages(e);
          return null;
         }
                }
                }
                return page.CM_BulkUpload3;
       }

    public PageReference ChangeCount(){
        allFileList.clear();
        //Adding multiple attachments
        for(Integer i = 0 ; i <= FileCount ; i++)
            allFileList.add(new Attachment());
         uploadList.add(new uploadWrapper(allFileList));
        if(FileCount > 0){
          return page.CM_BulkUpload2;
       }
      else{
       return null;
       }
       }

public PageReference pgBack(){
        allFileList.clear();
        FileCount = 0;
        return page.CM_BulkUpload;
     }
}

The Visualforce form meant to increase/decrease in size based on selection:
<apex:pageBlockSection title="Select Files" rendered="{!IF(FileCount != null && FileCount != 0, true , false)}">
                <apex:pageBlockTable value="{!uploadList}" style="border:1px solid black;" var="a" rendered="{!IF(FileCount != null && FileCount != 0, true , false)}">
             <apex:column headervalue="Claim Number (ex: CM-XXXXXXX)" style="border:1px solid black; width:115px; align:center">
             <apex:inputText value="{!a.claimNum}" style="border:1px solid black; width:115px; align:center"/>
             </apex:column>
             <apex:column headervalue="Invoice" style="border:1px solid black; width:50px; align:center">
             <apex:inputfile value="{!a.file}" filename="{!a.fileName}" onchange="check(this)" filesize="1000" size="50"/>
             </apex:column>
             </apex:pageBlockTable>
             </apex:pageBlockSection>
I'm puzzled as to why a query I'm working on is not returning any results, particularly when I tested the same query in the DataLoader as first to check that it would pull the results I wanted.  My class and method are below:

public with sharing class CM_ContractStatusUpdate{

public CM_ContractStatusUpdate(){
    
     }
   
    public void updateContracts(){
     List<MG_Contract_Holder__c> statUpd = new List<MG_Contract_Holder__c>();
     statUpd = [SELECT ID FROM MG_Contract_Holder__c WHERE Contract_Status__c = 'Active' AND Expiration_Date__c < TODAY LIMIT 99];
        if(statUpd.size() > 0){
        for(Integer i = 0; i < statUpd.size(); i ++){
         MG_Contract_Holder__c upd = [SELECT Contract_Status__c FROM MG_Contract_Holder__c WHERE ID =:statUpd[i].ID];
         upd.Contract_Status__c = 'Canceled';
         update upd;
         }
        }
     }

}
However, each time I run it the statUpd list fails to populate, even though my tests with the DataLoader returned the results I was expecting.  Would appreciate any thoughts on the error.