1

tried to deploy a a change set from 1 sandbox to another and it gives the error

"MyVisualForcePage does not exist or is not a valid override for action View"

. I included the VF page so I'm guessing it has to do with the way I overrided the View of the custom object with my VF page. Any clues? Here's MyVisualForcePage just in case I missed something(though its working fine even after tests). Any help appreciated, still a newbie at all this. Thanks in advance

<apex:page sidebar="false" showHeader="true" cache="false"     controller="GoogleMap_Meeting_Controller">
<style>
.activeTab {background-color: #236FBD; color:white;
background-image:none}
.inactiveTab { background-color: lightgrey; color:black;
background-image:none}
img {
max-width: none;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>    
![enter image description here][1]<script>
    var map;
    var clat;
    var clong;

    function initialize() {

        // set the map options in the format that V3 of googlemaps expects
        var mapOptions = {
            zoom: 9,
            center: new google.maps.LatLng(1.0931431 ,36.701831),
            mapTypeId: google.maps.MapTypeId.ROADMAP

        };
        // attach our map to the map_canvas div
        map = new google.maps.Map(document.getElementById('map_canvas'),mapOptions);


        // Pull the data in from the SOQL and use visualforce to create the javascript calls            
        <apex:repeat value="{!MeetingsList}" var="Meeting">        
            showAddress("{!JSENCODE(Meeting.Name)}", "Business Value:{!Meeting.Business_Value__c} {!Meeting.Meeting_Date__c} <a href='../{!Meeting.id}' target='_blank'>Details</a>", "{!Meeting.GPS_Meeting_Location__Latitude__s}", "{!Meeting.GPS_Meeting_Location__Longitude__s}", 1);
        </apex:repeat>

        <apex:repeat value="{!MeetingsList2}" var="Meeting">        
            showAddress("{!JSENCODE(Meeting.Name)}", "Business Value:{!Meeting.Business_Value__c} {!Meeting.Meeting_Date__c} <a href='../{!Meeting.id}' target='_blank'>Details</a>", "{!Meeting.GPS_Meeting_Location__Latitude__s}", "{!Meeting.GPS_Meeting_Location__Longitude__s}", 0);
        </apex:repeat>  

    } // function initialize()


    google.maps.event.addDomListener(window, 'load', initialize);



    function showAddress(title, content, Lat, Long, locType) {

        // convert our raw values to the format that google expects                                 
        var latlng = new google.maps.LatLng(parseFloat(Lat), parseFloat(Long));

        if (latlng != null) {

            // create an info window            
            var infowindow = new google.maps.InfoWindow({
                content: content
            });

            // Create a marker on the map                   
            var marker = new google.maps.Marker({
                position: latlng,
                map: map,
                title: title                        
            });
            if(locType == 1){
                marker.setIcon('http://maps.google.com/mapfiles/ms/icons/blue-dot.png');
            } else {
                marker.setIcon('http://maps.google.com/mapfiles/ms/icons/red-dot.png');
                marker.setAnimation(google.maps.Animation.BOUNCE);
                //Drawing circle
                var circle = new google.maps.Circle({
                    center: latlng,
                    radius: 20,
                    map: map,
                    fillOpacity: 0.2,
                    strokeOpacity: 0.5,
                    strokeWeight: 1
                      });
                    cLat = Lat;
                    cLong = Long;
                    //var clatlng = new google.maps.LatLng(parseFloat(cLat), parseFloat(cLong));
                    var div = document.getElementById("textDiv");
                    div.textContent = cLat + " " + cLong;
                    var text = div.textContent;
                    //map.setCenter(clatLng)

                    }
            //map.panTo(latlng);
            // Add an event to the marker so the info window will appear when it is clicked
            google.maps.event.addListener(marker, 'click', function() {
                infowindow.open(map,marker);
                infowindow.setTitle("HTML");
                infowindow.setContent(content);
                map.setZoom(9);
                map.setCenter(marker.getPosition());
            });

        } // check for null latlng due an error parsing

    } // end show address          

</script>
<apex:tabPanel switchType="client" selectedTab="tabdetails"
    id="AccountTabPanel" tabClass="activeTab"
    inactiveTabClass="inactiveTab">
        <apex:tab label="Details" name="AccDetails" id="tabdetails">
            <apex:detail relatedList="true" title="true"/>
        </apex:tab>
        <apex:tab label="Group meetings map" name="Contacts" id="tabContact">
            <div id="map_canvas" style="width:100%; height:300px"></div>
        <div id="textDiv"></div>
        </apex:tab>
</apex:tabPanel>

Here is my controller class

public with sharing class GoogleMap_Meeting_Controller {

public List<Meeting__c> MeetingsList {get;set;}
public List<Meeting__c> MeetingsList2 {get;set;}

public GoogleMap_Meeting_Controller() {

    Id id = ApexPages.currentPage().getParameters().get('id');
    MeetingsList = [SELECT Name, Group__r.Id, Business_Value__c, Meeting_Date__c, GPS_Meeting_Location__Latitude__s, GPS_Meeting_Location__Longitude__s FROM Meeting__c WHERE Group__r.Id =:id ORDER BY Meeting_Date__c DESC LIMIT 10 OFFSET 1];
    MeetingsList2 =[SELECT Name, Group__r.Id, Business_Value__c, Meeting_Date__c, GPS_Meeting_Location__Latitude__s, GPS_Meeting_Location__Longitude__s FROM Meeting__c WHERE Group__r.Id =:id ORDER BY Meeting_Date__c DESC LIMIT 1];


} // end constructor


} // end class
2

One problem is that (from Overriding Standard Buttons and Tab Home Pages):

When overriding buttons with a Visualforce page, only Visualforce pages that use the standard controller for the object on which the button appears can be selected

This means that your page needs to look like this (change "Account" to the type you want to override the view for):

<apex:page sidebar="false" showHeader="true" cache="false"
        standardController="Account"
        extensions="GoogleMap_Meeting_Controller"
        >

and your controller must have this constructor:

public GoogleMap_Meeting_Controller(ApexPages.StandardController sc) {
    ....
}

Though that wouldn't explain why the problem only occurs in the org you are deploying to.

  • My guess is that the VF page was originally using a standard controller, then Kollo changed it to use a custom controller, so now it can't be used as an override. – Jeremy Nottingham Oct 16 '14 at 11:51
  • @JeremyNottingham In the custom object the VF page was intended for, I had changed the view in Buttons, Links, and Actions to The VF page, but through a hack way of doing it. using an extension instead solved the problem – Rufus K. Oct 16 '14 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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