You need to sign in to do that
Don't have an account?
Erin Rico-Allen 2
Winter 19 Platform Developer 1 Maintenance Certification Getting error when trying to create custom app
Getting this error when I try to add my Towermaps to a new app builder page:
Here are the codes I have based on the trailhead exercise:
TowerMapUtilClass:
TowerMapControllerClass:
Towermap Controller:
I also created the cutom object Tower.
Anyone know where my break is?
Thanks!
Erin
Here are the codes I have based on the trailhead exercise:
TowerMapUtilClass:
public inherited sharing class TowerMapUtilClass { public static List<sObject> queryObjects(String theObject, List<String> theFields, String theFilter, String sortField, String sortOrder) { String theQuery = 'SELECT ' + string.join(theFields, ','); theQuery += ' FROM ' + theObject; if(!String.isEmpty(theFilter)) { theQuery += ' WHERE ' + theFilter; } if(!String.isEmpty(sortField)) { theQuery += ' ORDER BY ' + sortField; if(!String.isEmpty(sortOrder)) { theQuery += ' ' + sortOrder; } } return database.query(theQuery); }
TowerMapControllerClass:
public inherited sharing class TowerMapControllerClass { @AuraEnabled public static List<Tower__c> getAllTowers() { String theObject = 'Tower__c'; List<String> theFields = new List<String>{'Id', 'Name', 'State__r.Name', 'Tower_Location__Latitude__s', 'Tower_Location__Longitude__s'}; String theFilter = ''; String sortField = 'Name'; String sortOrder = 'ASC'; List<Tower__c> allTowers = TowerMapUtilClass.queryObjects(theObject, theFields, theFilter, sortField, sortOrder); return allTowers; }Towermap:
<aura:component implements="flexipage:availableForAllPageTypes" controller="TowerMapControllerClass" access="global" > <aura:attribute name="mapMarkers" type="Object" access="PRIVATE" /> <aura:attribute name="markersTitle" type="String" access="PRIVATE" /> <aura:handler name="init" value="{!this}" action="{!c.handleInit}"/> <aura:if isTrue="{!!empty(v.mapMarkers)}" > <lightning:map mapMarkers="{!v.mapMarkers}" markersTitle="{!v.markersTitle}" zoomLevel="5"/> </aura:if> </aura:component>
Towermap Controller:
({ handleInit: function (component, event, helper) { helper.initHelper(component, event, helper); } })Towermap Helper:
({ initHelper : function(component, event, helper) { helper.utilSetMarkers(component, event, helper); }, utilSetMarkers : function(component, event, helper) { let action = component.get("c.getAllTowers"); action.setCallback(this, function(response) { const data = response.getReturnValue(); const dataSize = data.length; let markers = []; for(let i=0; i < dataSize; i += 1) { const Tower = data[i]; markers.push({ 'location': { 'Latitude' : Tower.Tower_Location__Latitude__s, 'Longitude' : Tower.Tower_Location__Longitude__s }, 'icon': 'utility:Tower', 'title' : Tower.Name, 'description' : Tower.Name + ' Tower Location at ' + Tower.State__r.Name }); } component.set('v.markersTitle', 'Out and About Communications Tower Locations'); component.set('v.mapMarkers', markers); }); $A.enqueueAction(action); } })
I also created the cutom object Tower.
Anyone know where my break is?
Thanks!
Erin
All Answers
Error: Compile Error: Unrecognized symbol '"', which is not a valid Apex identifier. at line 1 column 28
Ensure sharing rules from the calling class are enforced for the the 'UtilityClass' Apex class.
Any idea
1.Create an object named “Tower”.
2.Create Utility class:
public inherited sharing class UtilityClass {
public static List<sObject> queryObjects(String theObject, List<String> theFields, String theFilter, String sortField, String sortOrder) {
String theQuery = 'SELECT ' + string.join(theFields, ',');
theQuery += ' FROM ' + theObject;
if(!String.isEmpty(theFilter)) {
theQuery += ' WHERE ' + theFilter;
}
if(!String.isEmpty(sortField)) {
theQuery += ' ORDER BY ' + sortField;
if(!String.isEmpty(sortOrder)) {
theQuery += ' ' + sortOrder;
}
}
return database.query(theQuery);
}
}
3.Create Apex class:TowerMapController
public inherited sharing class TowerMapController {
@AuraEnabled
public static List<Tower__c> getAllTowers() {
String theObject = 'Tower__c';
List<String> theFields = new List<String>{'Id', 'Name', 'State__r.Name', 'Tower_Location__Latitude__s', 'Tower_Location__Longitude__s'};
String theFilter = '';
String sortField = 'Name';
String sortOrder = 'ASC';
List<Tower__c> allTowers = UtilityClass.queryObjects(theObject, theFields, theFilter, sortField, sortOrder);
return allTowers;
}
}
4.Create Towermap Component:-
<aura:component implements="flexipage:availableForAllPageTypes" controller="TowerMapController" access="global" >
<aura:attribute name="mapMarkers" type="Object" access="PRIVATE" />
<aura:attribute name="markersTitle" type="String" access="PRIVATE" />
<aura:handler name="init" value="{!this}" action="{!c.handleInit}"/>
<aura:if isTrue="{!!empty(v.mapMarkers)}" >
<!-- Create lightning:map here -->
<lightning:map
mapMarkers="{! v.mapMarkers }"
zoomLevel="{!v.zoomLevel}" markersTitle="{!v.markersTitle}"/>
</aura:if>
</aura:component>
5.Controller:-
({
initHelper : function(component, event, helper) {
helper.utilSetMarkers(component, event, helper);
},
utilSetMarkers : function(component, event, helper) {
let action = component.get("c.getAllTowers");
action.setCallback(this, function(response) {
const data = response.getReturnValue();
const dataSize = data.length;
let markers = [];
for(let i=0; i < dataSize; i += 1) {
const Tower = data[i];
markers.push({
'location': {
'Latitude' : Tower.Tower_Location__Latitude__s,
'Longitude' : Tower.Tower_Location__Longitude__s
},
'icon': 'utility:Tower',
'title' : Tower.Name,
'description' : Tower.Name + ' Tower Location at ' + Tower.State__r.Name
});
}
component.set('v.markersTitle', 'Out and About Communications Tower Locations');
component.set('v.mapMarkers', markers);
});
$A.enqueueAction(action);
}
})
6.Helper :-
({
handleInit: function (component, event, helper) {
helper.initHelper(component, event, helper);
component.set('v.zoomLevel', 5);
}
})
<aura:component implements="flexipage:availableForAllPageTypes" controller="TowerMapController" access="global" >
<aura:attribute name="mapMarkers" type="Object" access="PRIVATE" />
<aura:attribute name="markersTitle" type="String" access="PRIVATE" />
<aura:handler name="init" value="{!this}" action="{!c.handleInit}"/>
<aura:if isTrue="{!!empty(v.mapMarkers)}" >
<!-- Create lightning:map here -->
<lightning:map
mapMarkers="{! v.mapMarkers }"
zoomLevel="{!v.zoomLevel}" markersTitle="{!v.markersTitle}"/>
</aura:if>
</aura:component>
Can someone please help me identify the error?
Below codes worked for me.
Towermap:
<aura:component implements="flexipage:availableForAllPageTypes" controller="TowerMapControllerClass" access="global" >
<aura:attribute name="mapMarkers" type="Object" access="PRIVATE" />
<aura:attribute name="markersTitle" type="String" access="PRIVATE" />
<aura:handler name="init" value="{!this}" action="{!c.handleInit}"/>
<aura:if isTrue="{!!empty(v.mapMarkers)}" >
<lightning:map
mapMarkers="{! v.mapMarkers }"
markersTitle = "{!v.markersTitle}"
zoomLevel="5" />
</aura:if>
</aura:component>
Towermap Controller:
({
handleInit: function (component, event, helper) {
helper.initHelper(component, event, helper);
}
})
Towermap Controller Class:
({
initHelper : function(component, event, helper) {
helper.utilSetMarkers(component, event, helper);
},
utilSetMarkers : function(component, event, helper) {
let action = component.get("c.getAllTowers");
action.setCallback(this, function(response) {
const data = response.getReturnValue();
const dataSize = data.length;
let markers = [];
for(let i=0; i < dataSize; i += 1) {
const Tower = data[i];
markers.push({
'location': {
'Latitude' : Tower.Tower_Location__Latitude__s,
'Longitude' : Tower.Tower_Location__Longitude__s
},
'icon': 'utility:Tower',
'title' : Tower.Name,
'description' : Tower.Name + ' Tower Location at ' + Tower.State__r.Name
});
}
component.set('v.markersTitle', 'Out and About Communications Tower Locations');
component.set('v.mapMarkers', markers);
});
$A.enqueueAction(action);
}
})
Towermap Controller Class:
public inherited sharing class TowerMapController {
@AuraEnabled
public static List<Tower__c> getAllTowers() {
String theObject = 'Tower__c';
List<String> theFields = new List<String>{'Id', 'Name', 'State__r.Name', 'Tower_Location__Latitude__s', 'Tower_Location__Longitude__s'};
String theFilter = '';
String sortField = 'Name';
String sortOrder = 'ASC';
List<Tower__c> allTowers = TowerMapUtilClass.queryObjects(theObject, theFields, theFilter, sortField, sortOrder);
return allTowers;
}
}
Towermap UtilClass:
public inherited sharing class TowerMapUtilClass {
public static List<sObject> queryObjects(String theObject, List<String> theFields, String theFilter, String sortField, String sortOrder) {
String theQuery = 'SELECT ' + string.join(theFields, ',');
theQuery += ' FROM ' + theObject;
if(!String.isEmpty(theFilter)) {
theQuery += ' WHERE ' + theFilter;
}
if(!String.isEmpty(sortField)) {
theQuery += ' ORDER BY ' + sortField;
if(!String.isEmpty(sortOrder)) {
theQuery += ' ' + sortOrder;
}
}
return database.query(theQuery);
}
}
Utility Class
public inherited sharing class UtilityClass {
public static List<sObject> queryObjects(String theObject, List<String> theFields, String theFilter, String sortField, String sortOrder) {
String theQuery = 'SELECT' + string.join(theFields, ',');
theQuery += ' FROM ' + theObject;
if(!String.isEmpty(theFilter)) {
theQuery += ' WHERE ' + theFilter;
}
if(!String.isEmpty(sortField)) {
theQuery += ' ORDER BY ' + sortField;
if(!String.isEmpty(sortOrder)) {
theQuery += ' ' + sortOrder;
}
}
return database.query(theQuery);
}
}
Hope this will help!
Thanks,
Sam
It is pretty easy, just need to follow the instructions said in the trailhead. Please check for errors and enforce inherited sharing keyword on Tower map controller and utility class. I can see some member are using unnecessary codes and extra code blocks.
Thanks
Vishnu
Just creating a lightning component is hard enough, if you haven't looked at Salesforce for a while.
Every single step of this is unnecessarily complicated and painful. Salesforce is so poorly designed, the interface is shocking. Not clear instuctions whatsoever. Total crap.
Callback failed: apex://TowerMapControllerClass/ACTION$getAllTowers
I followed the exact code that has been chosen as best answer
Please advice at the earliest. I wish to complete certification before end date April 19th
For all latest salesforce certification dumps mail us at salesforceworldwide@gmail.com
If you need help on any superbadge or salesforce certification mail us at salesforceworldwide@gmail.com
We have Following latest certification of
1. Admin 201
2. App Builder
3. Platform developer 1
4. Platform Developer 2
5. Sales Cloud
6. Service Cloud
7. Community Cloud
8. Marketing cloud Email Specialist
9. Marketing cloud Cloud Consultant
10. CPQ
11. FSL
12. Data Management Architecture
14. Integration architecture
15. Identity Access management
16. Development Lifecycle
17. Pardot Specialist/Consultant
19. Advance Admin
20. Sharing Visibilty Designer
21. Einstein Analytics
22. Non- Profit Cloud
For all latest salesforce certification dumps mail us at salesforceworldwide@gmail.com
If you need help on any superbadge or salesforce certification mail us at salesforceworldwide@gmail.com
We have Following latest certification of
1. Admin 201
2. App Builder
3. Platform developer 1
4. Platform Developer 2
5. Sales Cloud
6. Service Cloud
7. Community Cloud
8. Marketing cloud Email Specialist
9. Marketing cloud Cloud Consultant
10. CPQ
11. FSL
12. Data Management Architecture
14. Integration architecture
15. Identity Access management
16. Development Lifecycle
17. Pardot Specialist/Consultant
19. Advance Admin
20. Sharing Visibilty Designer
21. Einstein Analytics
22. Non- Profit Cloud
If you need help on any superbadge or salesforce certification mail us at salesforceworldwide@gmail.com
We have Following latest certification of
1. Admin 201
2. App Builder
3. Platform developer 1
4. Platform Developer 2
5. Sales Cloud
6. Service Cloud
7. Community Cloud
8. Marketing cloud Email Specialist
9. Marketing cloud Cloud Consultant
10. CPQ
11. FSL
12. Data Management Architecture
14. Integration architecture
15. Identity Access management
16. Development Lifecycle
17. Advance Admin
18. Sharing Visibilty Designer
19. Einstein Analytics
If you need help on any superbadge or salesforce certification mail us at salesforceworldwide@gmail.com
We have Following latest certification of
1. Admin 201
2. App Builder
3. Platform developer 1
4. Platform Developer 2
5. Sales Cloud
6. Service Cloud
7. Community Cloud
8. Marketing cloud Email Specialist
9. Marketing cloud Cloud Consultant
10. CPQ
11. FSL
12. Data Management Architecture
14. Integration architecture
15. Identity Access management
16. Development Lifecycle
17. Advance Admin
18. Sharing Visibilty Designer
19. Einstein Analytics
For all latest salesforce certification dumps mail us at ebsosedotcom@gmail.com
If you need help on any superbadge or salesforce certification mail us at ebsosedotcom@gmail.com (mailto:ebsosedotcom@gmail.com" style="color:blue; text-decoration:underline)
SPRING 20, Winter 20 Dumps all Available
We have Following latest certification of
0. B2B Commerce Admin
1. Admin 201
2. App Builder
3. Platform developer 1
4. Platform Developer 2
5. Sales Cloud
6. Service Cloud
7. Community Cloud
8. Marketing cloud Email Specialist
9. Marketing cloud Cloud Consultant
10. CPQ
11. FSL
12. Data Management Architecture
13. Integration architecture
14. Identity Access management
15. Development Lifecycle
16. Pardot Specialist/Consultant
17. Advance Admin
18. Sharing Visibilty Designer
19. Einstein Analytics
20. Non- Profit Cloud
For all latest salesforce certification dumps mail us at salesforceworldwide@gmail.com
If you need help on any superbadge or salesforce certification mail us at salesforceworldwide@gmail.com
24*7 fast responses to all queries
We have Following latest certification of
1. Admin 201
2. App Builder
3. Platform developer 1
4. Platform Developer 2
5. Sales Cloud
6. Service Cloud
7. Community Cloud
8. Marketing cloud Email Specialist
9. Marketing cloud Cloud Consultant
10. CPQ
11. FSL
12. Data Management Architecture
14. Integration architecture
15. Identity Access management
16. Development Lifecycle
17. Advance Admin
18. Sharing Visibilty Designer
19. Einstein Analytics
Project support and Salesforce training is also provided for Admin , Development , Integration , CPQ and QA at www.ebsose.com .
For all latest salesforce certification SU20 materials mail us at ebsosedotcom@gmail.com
If you need help on any superbadge or salesforce certification mail us at ebsosedotcom@gmail.com
Summer 20 Dumps all Available
We have Following latest certification of
0. B2B Commerce Admin
1. Admin 201
2. App Builder
3. Platform developer 1
4. Platform Developer 2
5. Sales Cloud
6. Service Cloud
7. Community Cloud
8. Marketing cloud Email Specialist
9. Marketing cloud Cloud Consultant
10. CPQ
11. FSL
12. Data Management Architecture
13. Integration architecture
14. Identity Access management
15. Development Lifecycle
16. Pardot Specialist
17. Advance Admin
18. Sharing Visibilty Designer
19. Einstein Analytics
20. Non- Profit Cloud
21. Marketing cloud developer 1
For all latest salesforce certification dumps mail us at allrecentdumps@gmail.com
If you need help on any superbadge or salesforce certification mail us at allrecentdumps@gmail.com
24*7 AND IMMEDIATE DELIVERY OF DUMPS.
All Summer 20 Dumps are available. We have Following latest certification of
• Copado Admin
• Copado Developer
• Vlocity Platform Essential
• B2B Commerce Admin
• Javascript Developer 1 Dumps
• Admin 201
• App Builder
• Platform developer 1
• Platform Developer 2
• Sales Cloud
• Service Cloud
• Community Cloud
• Marketing cloud Email Specialist
• Marketing cloud Cloud Consultant
• Marketing Cloud Admin
• Marketing Cloud Developer
• CPQ Specialist
• Field Service Lightning
• Data Management Architecture
• Integration architecture
• Identity Access management
• Development Lifecycle
• Pardot Specialist
• Advance Admin
• Sharing Visibilty Designer
• Einstein Analytics
• Admin 201
• App Builder
• Platform developer 1
• Platform Developer 2
• Sales Cloud
• Service Cloud
• Community Cloud
• Marketing cloud Email Specialist
• Marketing cloud Cloud Consultant
• Marketing Cloud Admin
• Marketing Cloud Developer
• CPQ Specialist
• Field Service Lightning
• Data Management Architecture
• Integration architecture
• Identity Access management
• Development Lifecycle
• Pardot Specialist
• Advance Admin
• Sharing Visibilty Designer
• Einstein Analytics
• Copado Admin
• Copado Developer
• Vlocity Platform Essential
• B2B Commerce Admin
• Javascript Developer 1 Dumps
You can contact me for any help and exact questions and answers for the latest Winter 22 certifications at salesforcecertguide2018@gmail.com. 100% pass rate. All exact screenshots and 100% accuracy. Trusted by all for passing all their exams. One to one guidance provided for every exam till completion. Free training materials will also be provided.
• Admin 201
• App Builder
• Platform developer 1
• Platform Developer 2
• Sales Cloud
• Service Cloud
• Community Cloud
• Marketing cloud Email Specialist
• Marketing cloud Cloud Consultant
• Marketing Cloud Admin
• Marketing Cloud Developer
• CPQ Specialist
• Field Service Lightning
• Data Management Architecture
• Integration architecture
• Identity Access management
• Development Lifecycle
• Pardot Specialist
• Advance Admin
• Sharing Visibilty Designer
• Einstein Analytics
• Javascript Developer 1 Dumps
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
You can contact me for any help and exact questions and answers for the latest Winter 22 certifications at salesforcecertguide2018@gmail.com. 100% pass rate. All exact screenshots and 100% accuracy. Trusted by all for passing all their exams. One to one guidance provided for every exam till completion. Free training materials will also be provided.
• Admin 201
• App Builder
• Platform developer 1
• Platform Developer 2
• Sales Cloud
• Service Cloud
• Community Cloud
• Marketing cloud Email Specialist
• Marketing cloud Cloud Consultant
• Marketing Cloud Admin
• Marketing Cloud Developer
• CPQ Specialist
• Field Service Lightning
• Data Management Architecture
• Integration architecture
• Identity Access management
• Development Lifecycle
• Pardot Specialist
• Advance Admin
• Sharing Visibilty Designer
• Einstein Analytics
• Javascript Developer 1 Dumps
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
You can contact me for any help and exact questions and answers for the latest Winter 22 certifications at salesforcecertguide2018@gmail.com. 100% pass rate. All exact screenshots and 100% accuracy. Trusted by all for passing all their exams. One to one guidance provided for every exam till completion. Free training materials will also be provided.
• Admin 201
• App Builder
• Platform developer 1
• Platform Developer 2
• Sales Cloud
• Service Cloud
• Community Cloud
• Marketing cloud Email Specialist
• Marketing cloud Cloud Consultant
• Marketing Cloud Admin
• Marketing Cloud Developer
• CPQ Specialist
• Field Service Lightning
• Data Management Architecture
• Integration architecture
• Identity Access management
• Development Lifecycle
• Pardot Specialist
• Advance Admin
• Sharing Visibilty Designer
• Einstein Analytics
• Javascript Developer 1 Dumps
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
You can contact me for any help and exact questions and answers for the latest Winter 22 certifications at salesforcecertguide2018@gmail.com. 100% pass rate. All exact screenshots and 100% accuracy. Trusted by all for passing all their exams. One to one guidance provided for every exam till completion. Free training materials will also be provided.
• Admin 201
• App Builder
• Platform developer 1
• Platform Developer 2
• Sales Cloud
• Service Cloud
• Community Cloud
• Marketing cloud Email Specialist
• Marketing cloud Cloud Consultant
• Marketing Cloud Admin
• Marketing Cloud Developer
• CPQ Specialist
• Field Service Lightning
• Data Management Architecture
• Integration architecture
• Identity Access management
• Development Lifecycle
• Pardot Specialist
• Advance Admin
• Sharing Visibilty Designer
• Einstein Analytics
• Javascript Developer 1 Dumps
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------