You need to sign in to do that
Don't have an account?
sivapriyaa maniam sivakumar
Error : common.apex.runtime.bytecode.BytecodeApexObjectType cannot be cast to common.apex.runtime.impl.ApexType
Hi,
I am getting error "common.apex.runtime.bytecode.BytecodeApexObjectType cannot be cast to common.apex.runtime.impl.ApexType"
I share my code .please view and tell me the solution,
I am getting error when i used recordSetVar="location"
If not, it shows the map but i could not zoom it and it struck.
VFP:
Apex Controller:
Thanks in Advances,
Sivapriyaa M S
I am getting error "common.apex.runtime.bytecode.BytecodeApexObjectType cannot be cast to common.apex.runtime.impl.ApexType"
I share my code .please view and tell me the solution,
I am getting error when i used recordSetVar="location"
If not, it shows the map but i could not zoom it and it struck.
VFP:
<apex:page sidebar="false" showheader="false" standardController="Loc__c" recordSetVar="location" extensions="VicinageFindNearby"> <apex:includeScript value="{!$Resource.googleMapsAPI}" /> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"> </script> <style> html, body { height: 100%; } .page-map, .ui-content, #map-canvas { width: 100%; height:100%; padding: 0; } #map-canvas { height: min-height: 100%; } </style> <script> function initialize() { var lat, lon,accts; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position){ lat = position.coords.latitude; lon = position.coords.longitude; Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.VicinageFindNearby.getNearby}', lat, lon, function(result, event){ if (event.status) { console.log(result); createMap(lat, lon, result); } else if (event.type == 'exception') { } else { } }, {escape: true} ); }); } else { lat = 51.096214; lon = 3.683153; var result = []; createMap(lat, lon, result); } } function createMap(lat,lon,accts){ var currentPosition = new google.maps.LatLng(lat,lon); var mapDiv = document.getElementById('map-canvas'); var map = new google.maps.Map(mapDiv, { center: currentPosition, zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }); var positionMarker = new google.maps.Marker({ map: map, position: currentPosition, icon: 'http://maps.google.com/mapfiles/ms/micons/green.png' }); var mapBoundary = new google.maps.LatLngBounds(); mapBoundary.extend(currentPosition); var acct; for(var i=0; i<accts.length;i++){ acct = accts[i]; console.log(accts[i]); setupMarker(); } map.fitBounds(mapBoundary); function setupMarker(){ var acctNavUrl; try{ if(sforce.one){ acctNavUrl = 'javascript:sforce.one.navigateToSObject(\'' + acct.Id + '\')'; } } catch(err) { console.log(err); acctNavUrl = '\\' + acct.Id; } var acctDetails = '<a href="' + acctNavUrl + '">' + acct.Name + '</a><br/>' + acct.City__c + '<br/>' + acct.Country__c + '<br/>' + acct.Zip_Code__c; var infowindow = new google.maps.InfoWindow({ content: acctDetails }); var marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng( acct.Map__Latitude__s, acct.Map__Longitude__s) }); mapBoundary.extend(marker.getPosition()); google.maps.event.addListener(marker, 'click', function(){ infowindow.open(map, marker); }); } } google.maps.event.addDomListener(window, 'load', initialize); </script> <body style="font-family: Arial; border: 0 none;"> <div id="map-canvas"></div> </body> </apex:page>
Apex Controller:
global with sharing class VicinageFindNearby { public VicinageFindNearby(ApexPages.StandardController controller) {} @RemoteAction global static List<Loc__c> getNearby(String lat, String lon) { if(lat == null || lon == null || lat.equals('') || lon.equals('')) { lat = '40.427305'; lon = '3.696754'; } String queryString = 'SELECT Id, Name, Map__Longitude__s, Map__Latitude__s,State_Province__c,City__c,Zip_Code__c ' + 'FROM Loc__c '+ 'WHERE DISTANCE(Map__c, GEOLOCATION('+lat+','+lon+'), \'km\') < 20 ' + 'ORDER BY DISTANCE(Map__c, GEOLOCATION('+lat+','+lon+'), \'km\') ' + 'LIMIT 25'; return(database.Query(queryString)); } }
Thanks in Advances,
Sivapriyaa M S
[1] http://success.sfdc.cdnetworks.com/issues_view?id=a1p300000008bIkAAI