• BJM
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hi All
          How to Upaload Contacts From Excel File not a CSV File Through Visualforce Page
     


Thanks in Advance...!
  • March 30, 2015
  • Like
  • 0
Hi,
I have displayed all the contacts and Leads on google maps from the cuurent location with 10km distance
here i have displayed an infowindow including button named Getdirection for each marker(Contacts and Leads),
here i need to display the route map from current location to particular selected marker



Thanks & Regards
  • January 31, 2015
  • Like
  • 1
Hi all ,
          I have a requirement that i need to to display all Contacts and Leads of our Organization on Google maps using Single Visualforce page to track All Contacts and Leads from Current Location, Here i displayed all Leads from current location but i need to display All Contacts also for the same Page if any one knows pls help

Here is my code

Class:
--------
global with sharing class LeadsNearbyMe {

public Lead leads{get; set;}

@RemoteAction
   global static List<Lead> getNearby(String lat, String lon) {

        if(lat == null || lon == null || lat.equals('') || lon.equals('')) {
            lat = '51.096214';
            lon = '3.683153';
        }

        String queryString =
            'SELECT Id, Name, Location__Longitude__s, Location__Latitude__s, ' +
                'Street, City,State,Country, PostalCode ' +
            'FROM Lead ' +
            'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') < 60 ' +
            'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') ' +
            'LIMIT 25';
        return(database.Query(queryString));
    }
}

Page:
--------

<apex:page sidebar="false" showheader="false" controller="LeadsNearbyMe">
 
  <apex:includeScript value="{!$Resource.googleMapsAPI}" />
      <script type="text/javascript"
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCROH4OR9fzDhmprWPL1wGWfPT4uGUeMWg&sensor=false">
        </script>
        
    <!-- Setup the map to take up the whole window -->
    <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;
          
             if (navigator.geolocation) {
                 navigator.geolocation.getCurrentPosition(function(position){
                     lat = position.coords.latitude;
                     lon = position.coords.longitude;                    
                     
                     // Use Visualforce JavaScript Remoting to query for nearby conts      
                     Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.LeadsNearbyMe.getNearby}', lat, lon,
                         function(result, event){
                             if (event.status) {
                                 console.log(result);
                                 createMap(lat, lon, result);           
                             } else if (event.type === 'exception') {
                                 //exception case code          
                             } else {
                                            
                             }
                          },
                          {escape: true}
                      );
                  });
              } else {
                  // Set default values for map if the device doesn't have geolocation capabilities
                    /** Eindhoven **/
                    lat = 51.096214;
                    lon = 3.683153;
                    
                    var result = [];
                    createMap(lat, lon, result);
              }
          
         }
    
         function createMap(lat, lon, leads){
            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
            });
            
            // Set a marker for the current location
            var positionMarker = new google.maps.Marker({
                map: map,
                position: currentPosition,
                title: 'You are here',
            });
            
            // Keep track of the map boundary that holds all markers
            var mapBoundary = new google.maps.LatLngBounds();
            mapBoundary.extend(currentPosition);
            
            // Set markers on the map from the @RemoteAction results
            var cont;
            for(var i=0; i<leads.length;i++){
                cont = leads[i];
                console.log(leads[i]);
                setupMarker();
            }
       map.fitBounds(mapBoundary);

           function setupMarker(){
                var contNavUrl;
           
                try{
                    if(sforce.one){
                        contNavUrl =
                            'javascript:sforce.one.navigateToSObject(\'' + cont.Id + '\')';
                    }
                } catch(err) {
                    console.log(err);
                    contNavUrl = '\\' + cont.Id;
                }
                
                var contDetails =
                    
                    cont.Name + ',' +
                    cont.Street + ',' +
                    cont.City + ',' +
                    cont.PostalCode;
           var marker = new google.maps.Marker({
                   map: map,
                   icon : "{!URLFOR($Resource.GoogleMarkers, 'GoogleMark/4-l.png')}",
                   title:contDetails,
                   position: new google.maps.LatLng(
                                   cont.Location__Latitude__s,
                                   cont.Location__Longitude__s)
               });
               mapBoundary.extend(marker.getPosition());
           }
                  
           }
 
        google.maps.event.addDomListener(window, 'load', initialize);
        
    </script>
<body style="font-family: Arial; border: 0 none;">
 
        <div id="map-canvas"></div>
    </body>
 
</apex:page>


Screen shot:
------------------

User-added image


Thanks & Regards,
  • January 07, 2015
  • Like
  • 2
Hi, all

I have created visual force page for selected records from stanards contacts list view,
i created one custom button called MassEdit and add the button to Standard Contacts list view ,
and assign the page which created for selected records to edit,
but here the page is redirecting when i click the MassEdit button from standard Contact List view
but iam getting blank white page.

here i need when i select multiple records from standard list view and click on MassEdit button it will redirect to page and selected records are in the editable mode, 

help me
  • May 06, 2014
  • Like
  • 0
Hi,
I have displayed all the contacts and Leads on google maps from the cuurent location with 10km distance
here i have displayed an infowindow including button named Getdirection for each marker(Contacts and Leads),
here i need to display the route map from current location to particular selected marker



Thanks & Regards
  • January 31, 2015
  • Like
  • 1
Hi all ,
          I have a requirement that i need to to display all Contacts and Leads of our Organization on Google maps using Single Visualforce page to track All Contacts and Leads from Current Location, Here i displayed all Leads from current location but i need to display All Contacts also for the same Page if any one knows pls help

Here is my code

Class:
--------
global with sharing class LeadsNearbyMe {

public Lead leads{get; set;}

@RemoteAction
   global static List<Lead> getNearby(String lat, String lon) {

        if(lat == null || lon == null || lat.equals('') || lon.equals('')) {
            lat = '51.096214';
            lon = '3.683153';
        }

        String queryString =
            'SELECT Id, Name, Location__Longitude__s, Location__Latitude__s, ' +
                'Street, City,State,Country, PostalCode ' +
            'FROM Lead ' +
            'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') < 60 ' +
            'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') ' +
            'LIMIT 25';
        return(database.Query(queryString));
    }
}

Page:
--------

<apex:page sidebar="false" showheader="false" controller="LeadsNearbyMe">
 
  <apex:includeScript value="{!$Resource.googleMapsAPI}" />
      <script type="text/javascript"
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCROH4OR9fzDhmprWPL1wGWfPT4uGUeMWg&sensor=false">
        </script>
        
    <!-- Setup the map to take up the whole window -->
    <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;
          
             if (navigator.geolocation) {
                 navigator.geolocation.getCurrentPosition(function(position){
                     lat = position.coords.latitude;
                     lon = position.coords.longitude;                    
                     
                     // Use Visualforce JavaScript Remoting to query for nearby conts      
                     Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.LeadsNearbyMe.getNearby}', lat, lon,
                         function(result, event){
                             if (event.status) {
                                 console.log(result);
                                 createMap(lat, lon, result);           
                             } else if (event.type === 'exception') {
                                 //exception case code          
                             } else {
                                            
                             }
                          },
                          {escape: true}
                      );
                  });
              } else {
                  // Set default values for map if the device doesn't have geolocation capabilities
                    /** Eindhoven **/
                    lat = 51.096214;
                    lon = 3.683153;
                    
                    var result = [];
                    createMap(lat, lon, result);
              }
          
         }
    
         function createMap(lat, lon, leads){
            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
            });
            
            // Set a marker for the current location
            var positionMarker = new google.maps.Marker({
                map: map,
                position: currentPosition,
                title: 'You are here',
            });
            
            // Keep track of the map boundary that holds all markers
            var mapBoundary = new google.maps.LatLngBounds();
            mapBoundary.extend(currentPosition);
            
            // Set markers on the map from the @RemoteAction results
            var cont;
            for(var i=0; i<leads.length;i++){
                cont = leads[i];
                console.log(leads[i]);
                setupMarker();
            }
       map.fitBounds(mapBoundary);

           function setupMarker(){
                var contNavUrl;
           
                try{
                    if(sforce.one){
                        contNavUrl =
                            'javascript:sforce.one.navigateToSObject(\'' + cont.Id + '\')';
                    }
                } catch(err) {
                    console.log(err);
                    contNavUrl = '\\' + cont.Id;
                }
                
                var contDetails =
                    
                    cont.Name + ',' +
                    cont.Street + ',' +
                    cont.City + ',' +
                    cont.PostalCode;
           var marker = new google.maps.Marker({
                   map: map,
                   icon : "{!URLFOR($Resource.GoogleMarkers, 'GoogleMark/4-l.png')}",
                   title:contDetails,
                   position: new google.maps.LatLng(
                                   cont.Location__Latitude__s,
                                   cont.Location__Longitude__s)
               });
               mapBoundary.extend(marker.getPosition());
           }
                  
           }
 
        google.maps.event.addDomListener(window, 'load', initialize);
        
    </script>
<body style="font-family: Arial; border: 0 none;">
 
        <div id="map-canvas"></div>
    </body>
 
</apex:page>


Screen shot:
------------------

User-added image


Thanks & Regards,
  • January 07, 2015
  • Like
  • 2
Hi All
          How to Upaload Contacts From Excel File not a CSV File Through Visualforce Page
     


Thanks in Advance...!
  • March 30, 2015
  • Like
  • 0
Hi all ,
          I have a requirement that i need to to display all Contacts and Leads of our Organization on Google maps using Single Visualforce page to track All Contacts and Leads from Current Location, Here i displayed all Leads from current location but i need to display All Contacts also for the same Page if any one knows pls help

Here is my code

Class:
--------
global with sharing class LeadsNearbyMe {

public Lead leads{get; set;}

@RemoteAction
   global static List<Lead> getNearby(String lat, String lon) {

        if(lat == null || lon == null || lat.equals('') || lon.equals('')) {
            lat = '51.096214';
            lon = '3.683153';
        }

        String queryString =
            'SELECT Id, Name, Location__Longitude__s, Location__Latitude__s, ' +
                'Street, City,State,Country, PostalCode ' +
            'FROM Lead ' +
            'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') < 60 ' +
            'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') ' +
            'LIMIT 25';
        return(database.Query(queryString));
    }
}

Page:
--------

<apex:page sidebar="false" showheader="false" controller="LeadsNearbyMe">
 
  <apex:includeScript value="{!$Resource.googleMapsAPI}" />
      <script type="text/javascript"
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCROH4OR9fzDhmprWPL1wGWfPT4uGUeMWg&sensor=false">
        </script>
        
    <!-- Setup the map to take up the whole window -->
    <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;
          
             if (navigator.geolocation) {
                 navigator.geolocation.getCurrentPosition(function(position){
                     lat = position.coords.latitude;
                     lon = position.coords.longitude;                    
                     
                     // Use Visualforce JavaScript Remoting to query for nearby conts      
                     Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.LeadsNearbyMe.getNearby}', lat, lon,
                         function(result, event){
                             if (event.status) {
                                 console.log(result);
                                 createMap(lat, lon, result);           
                             } else if (event.type === 'exception') {
                                 //exception case code          
                             } else {
                                            
                             }
                          },
                          {escape: true}
                      );
                  });
              } else {
                  // Set default values for map if the device doesn't have geolocation capabilities
                    /** Eindhoven **/
                    lat = 51.096214;
                    lon = 3.683153;
                    
                    var result = [];
                    createMap(lat, lon, result);
              }
          
         }
    
         function createMap(lat, lon, leads){
            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
            });
            
            // Set a marker for the current location
            var positionMarker = new google.maps.Marker({
                map: map,
                position: currentPosition,
                title: 'You are here',
            });
            
            // Keep track of the map boundary that holds all markers
            var mapBoundary = new google.maps.LatLngBounds();
            mapBoundary.extend(currentPosition);
            
            // Set markers on the map from the @RemoteAction results
            var cont;
            for(var i=0; i<leads.length;i++){
                cont = leads[i];
                console.log(leads[i]);
                setupMarker();
            }
       map.fitBounds(mapBoundary);

           function setupMarker(){
                var contNavUrl;
           
                try{
                    if(sforce.one){
                        contNavUrl =
                            'javascript:sforce.one.navigateToSObject(\'' + cont.Id + '\')';
                    }
                } catch(err) {
                    console.log(err);
                    contNavUrl = '\\' + cont.Id;
                }
                
                var contDetails =
                    
                    cont.Name + ',' +
                    cont.Street + ',' +
                    cont.City + ',' +
                    cont.PostalCode;
           var marker = new google.maps.Marker({
                   map: map,
                   icon : "{!URLFOR($Resource.GoogleMarkers, 'GoogleMark/4-l.png')}",
                   title:contDetails,
                   position: new google.maps.LatLng(
                                   cont.Location__Latitude__s,
                                   cont.Location__Longitude__s)
               });
               mapBoundary.extend(marker.getPosition());
           }
                  
           }
 
        google.maps.event.addDomListener(window, 'load', initialize);
        
    </script>
<body style="font-family: Arial; border: 0 none;">
 
        <div id="map-canvas"></div>
    </body>
 
</apex:page>


Screen shot:
------------------

User-added image


Thanks & Regards,
  • January 07, 2015
  • Like
  • 2
Hi, all

I have created visual force page for selected records from stanards contacts list view,
i created one custom button called MassEdit and add the button to Standard Contacts list view ,
and assign the page which created for selected records to edit,
but here the page is redirecting when i click the MassEdit button from standard Contact List view
but iam getting blank white page.

here i need when i select multiple records from standard list view and click on MassEdit button it will redirect to page and selected records are in the editable mode, 

help me
  • May 06, 2014
  • Like
  • 0