3

I am getting a little lost here and have read the related topics on stackexchange carefully. I am using the standard controller for a custom object in a managed package. This code works perfectly in a deployed org, but when I put it into my dev org I get the error. I am prefixing with name space and using fully qualified fields.

Here is the VF page code;

<apex:page standardController="ELTON__Equipment_Count__c">
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
  html, body, #map_canvas {
    margin: 0;
    padding: 0;
    height: 100%;
  }
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
  var map;
  function initialize() {
    var mapOptions = {
      zoom: 12,
     center: new google.maps.LatLng({!ELTON__Equipment_Count__c.ELTON__GPS_Lat__c},{!ELTON__Equipment_Count__c.ELTON__GPS_Long__c} ),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById('map_canvas'),
        mapOptions);
        marker = new google.maps.Marker({position: new google.maps.LatLng({!ELTON__Equipment_Count__c.ELTON__GPS_Lat__c},{!ELTON__Equipment_Count__c.ELTON__GPS_Long__c}), map: map });
  }

  google.maps.event.addDomListener(window, 'load', initialize);
</script>
</meta>
</meta>
</head>
<body>
 <div id="map_canvas"></div>
</body>
</html>
</apex:page>

I was able to resolve this by pasting in the code from eyescream directly.

3
  • BTW if you fixed the namespace then implemented GPS per @eyescream, your references would read as Equipment_Count__c.GPS__Latitude__s and Equipment_Count__c.GPS__Longitude__s Commented Feb 2, 2013 at 0:39
  • did you try this? salesforce.stackexchange.com/a/7984/320 Commented Feb 4, 2013 at 13:35
  • hey @GordonDerk, please can you paste the final code you used? Commented Feb 25, 2013 at 0:25

3 Answers 3

0

Happens to me sometimes even in standard (unpackaged) code. Can you try putting your Lat/Long merge fields somewhere closer to the top of the page (before they're actually used). Sth like

<apex:outputPanel style="display:none;visibility:hidden">
{!ELTON__Equipment_Count__c.ELTON__GPS_Lat__c}
{!ELTON__Equipment_Count__c.ELTON__GPS_Long__c}
</apex:outputPanel>

I have no idea what actually happens, probably the suggesting engine in VF skips over certain Javascript tags (but I saw it complaining also in vanilla HTML). Basically something might get stupid underway and the internal equivalent of addFields() is not being called properly.

P.S. You know you SF has now built-in Geolocation fields, do you? ;)

3
  • That was it thanks. I am aware of the goelocation fields in beta, but I cannot seem to find a reference to when they will be GA. I am adding this mapping functionality now. Thanks again for your help, this one really got me. Commented Feb 4, 2013 at 15:52
  • Glad it helped (I seriously have no idea why, what I do is a bit of "cargo cult" programming). Regarding geo fields: I think they're Generally Available already (since Winter'13), beta means it's still worked on but not something done as pilot /opt-in program! I have them in my 2 Dev Editions (one ancient from 2007, one from Jan'13), I saw them in 1 Enterprise and 1 Unlimited Edition. If you really don't have them enabled - contact support? I remember filtered lookups & joined reports were beta too but that didn't stop you from relying on them in "production" instances...
    – eyescream
    Commented Feb 4, 2013 at 16:45
  • hey @GordonDerk - are you still qualifying the namespace in your field accessors? Commented Feb 25, 2013 at 0:24
2

My first thought would be to check your Field Level Security settings. If you don't have access to those fields in this new environment, it will cause you issues.

1

You can fix this by removing the ELTON__ qualifiers and letting the platform resolve the namespace.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .