• angela mullen-smith 18
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies
I have a button which creates a Visual force form that extracts data from the Account Object and displays it in a presentation format. 
How can I create an action to Save that form that I have created to the Account record and also to a Share point folder
I have created an approval process and it works in Classic. In Lightning there is no submit for Approval on the Page
I have been working through my trailhead exercises and finally bought myself a Java book. I have also been using the tutorials on W3 school to learn about Google Maps - a really good tutorial if anyone is interested.

I developed my Apex classes and created my Visualforce page which displayed the sites on a Google map and I was very excited about it.

Now, I have been asked to display the Icons as different markers based on the value of a field  

So, the field is called TYPE and the values are small, medium and large. 

Type = Small,     Icon = Red
Type = Medium, Icon = Amber
Type = Large ,   Icon = Green

How do I write the code - would I put an IF/ELSE statement

Do I add it to the Add Marker?

If anyone coud point me to good documentation - would be gratefully appreciated

<apex:page sidebar="false" showheader="false" controller="FacilityRemoter">
 
 
<head>
 
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0; padding: 0 }
  #map-canvas { height: 100% }
</style>
<script src="https://maps.googleapis.com/maps/api/js?key= MYKEY&region=AU">
 
</script>
<script>
var map;
function initialize() {
    var mapOptions = {
        center: new google.maps.LatLng(-16.45789579, 145.3789838),
        zoom: 15
    };
    map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
    loadFacilities();
}
function loadFacilities() {
    Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.FacilityRemoter.findAll}',
        function(result, event){
            if (event.status) {
                for (var i=0; i<result.length; i++) {
                    var id = result[i].Id;
                    var name = result[i].Name;
                    var lat = result[i].Location__Latitude__s;
                    var lng = result[i].Location__Longitude__s;
                    addMarker(id, name, lat, lng);
                }
            } else {
                alert(event.message);
            }
        },
        {escape: true}
    );
}
function addMarker(id, name, lat, lng) {
    var marker = new google.maps.Marker({
            position: new google.maps.LatLng(lat, lng),
            map: map,
            title: name
    });
    google.maps.event.addListener(marker, 'click', function(event) {
        window.top.location = '/' + id;
    });
}
 
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
  <div id="map-canvas"/>
</body>
</apex:page>
 
I have build the app, written the controller and visualforce page and mapped the hotels onto a google map.
I need to write a test class for the HotelRemoter extension and I am getting myself confused as I am not sure how to write it

This is the Test class
1
2
3
4
5
6
7
global with sharing class HotelRemoter {
    @RemoteAction
    global static List<Hotel__c> findAll() {
        return [SELECT Id, Name, Location__Latitude__s, Location__Longitude__s
                    FROM Hotel__c];
    }
}

This is the Visualforce page

<apex:page sidebar="false" showheader="false" controller="HotelRemoter">
 
 
<head>
 
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0; padding: 0 }
  #map-canvas { height: 100% }
</style>
<script src="https://maps.googleapis.com/maps/api/js?key= AIzaSyC3GwkxsiGHfc0y5sheupDf7QzKtbFI4jg&sensor=false">
 
</script>
<script>
var map;
function initialize() {
    var mapOptions = {
        center: new google.maps.LatLng(37.784173, -122.401557),
        zoom: 15
    };
    map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
    loadHotels();
}
function loadHotels() {
    Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.HotelRemoter.findAll}',
        function(result, event){
            if (event.status) {
                for (var i=0; i<result.length; i++) {
                    var id = result[i].Id;
                    var name = result[i].Name;
                    var lat = result[i].Location__Latitude__s;
                    var lng = result[i].Location__Longitude__s;
                    addMarker(id, name, lat, lng);
                }
            } else {
                alert(event.message);
            }
        },
        {escape: true}
    );
}
function addMarker(id, name, lat, lng) {
    var marker = new google.maps.Marker({
            position: new google.maps.LatLng(lat, lng),
            map: map,
            title: name
    });
    google.maps.event.addListener(marker, 'click', function(event) {
        window.top.location = '/' + id;
    });
}
 
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
  <div id="map-canvas"/>
</body>
</apex:page>

I don't quite understand how to write a test this controller.



 
I am getting myself confused here - I have built the App and my hotels are displaying on the Google map which is fab, but I now want to transfer it into Production and I appreciate that I need to test the Controller.

Am I testing that I can create a new record in my custom object?

OR

Am I testing that a new visualforce page is created
I have created a test class - my 1st and I am getting an error that I do not understand
Facility is the name of the Object, and I am simply trying to create a new record in this object

User-added image
I have a button which creates a Visual force form that extracts data from the Account Object and displays it in a presentation format. 
How can I create an action to Save that form that I have created to the Account record and also to a Share point folder
I have been working through my trailhead exercises and finally bought myself a Java book. I have also been using the tutorials on W3 school to learn about Google Maps - a really good tutorial if anyone is interested.

I developed my Apex classes and created my Visualforce page which displayed the sites on a Google map and I was very excited about it.

Now, I have been asked to display the Icons as different markers based on the value of a field  

So, the field is called TYPE and the values are small, medium and large. 

Type = Small,     Icon = Red
Type = Medium, Icon = Amber
Type = Large ,   Icon = Green

How do I write the code - would I put an IF/ELSE statement

Do I add it to the Add Marker?

If anyone coud point me to good documentation - would be gratefully appreciated

<apex:page sidebar="false" showheader="false" controller="FacilityRemoter">
 
 
<head>
 
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0; padding: 0 }
  #map-canvas { height: 100% }
</style>
<script src="https://maps.googleapis.com/maps/api/js?key= MYKEY&region=AU">
 
</script>
<script>
var map;
function initialize() {
    var mapOptions = {
        center: new google.maps.LatLng(-16.45789579, 145.3789838),
        zoom: 15
    };
    map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
    loadFacilities();
}
function loadFacilities() {
    Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.FacilityRemoter.findAll}',
        function(result, event){
            if (event.status) {
                for (var i=0; i<result.length; i++) {
                    var id = result[i].Id;
                    var name = result[i].Name;
                    var lat = result[i].Location__Latitude__s;
                    var lng = result[i].Location__Longitude__s;
                    addMarker(id, name, lat, lng);
                }
            } else {
                alert(event.message);
            }
        },
        {escape: true}
    );
}
function addMarker(id, name, lat, lng) {
    var marker = new google.maps.Marker({
            position: new google.maps.LatLng(lat, lng),
            map: map,
            title: name
    });
    google.maps.event.addListener(marker, 'click', function(event) {
        window.top.location = '/' + id;
    });
}
 
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
  <div id="map-canvas"/>
</body>
</apex:page>
 
I am getting myself confused here - I have built the App and my hotels are displaying on the Google map which is fab, but I now want to transfer it into Production and I appreciate that I need to test the Controller.

Am I testing that I can create a new record in my custom object?

OR

Am I testing that a new visualforce page is created
I have created a test class - my 1st and I am getting an error that I do not understand
Facility is the name of the Object, and I am simply trying to create a new record in this object

User-added image