Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
    
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 –  user320 Feb 2 '13 at 0:39
    
did you try this? salesforce.stackexchange.com/a/7984/320 –  user320 Feb 4 '13 at 13:35
    
hey @GordonDerk, please can you paste the final code you used? –  user320 Feb 25 '13 at 0:25
add comment

3 Answers 3

up vote 0 down vote accepted

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? ;)

share|improve this answer
    
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. –  Gordon Derk Feb 4 '13 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 Feb 4 '13 at 16:45
    
hey @GordonDerk - are you still qualifying the namespace in your field accessors? –  user320 Feb 25 '13 at 0:24
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.