Showing posts with label Platform Developer I Certification Maintenance (Winter '19). Show all posts
Showing posts with label Platform Developer I Certification Maintenance (Winter '19). Show all posts

Tuesday, January 1, 2019

Platform Developer I Certification Maintenance (Winter '19)



Platform Developer I Certification Maintenance (Winter '19)





→ Understand New and Updated Apex Methods, Exceptions, and Interfaces


1. Which method of the DescribeSObjectResult class allows you to access record types by their developer name?
A. getRecordTypeInfos()
B. getRecordTypeInfosById()
C. getRecordTypeInfosByName()
D. getRecordTypeInfosByDeveloperName()

2. Which Apex class includes new methods to verify digital and HMAC signatures?
A. System.Auth
B. System.Crypto
C. System.Approval
D. Schema.Signature

→ Learn What's New for Platform Developers


1. Your org has My Domain enabled. What is the most efficient method to obtain a valid session ID to make an HTTP callout from asynchronous Apex code to Salesforce APIs?
A. Use a Named Credential.
B. Use System.UserInfo.getSessionId().
C. Set the endpoint to URL.getOrgDomainUrl()
D. Session IDs are no longer required when My Domain is enabled.

2. Which annotation allows a developer to make the result of an Apex method storable for Lightning components?
A. @AuraStorable
B. @AuraCacheable
C. @AuraEnabled(storable=true)
D. @AuraEnabled(cacheable=true)

3. Which merge field allows you to isolate untrusted third-party content with <apex:iframe> tag in Visualforce?
A. $Resource
B. $SecureResource
C. $IFrameResource
D. $Page.IFrameResource

4. Prior to installing an unlocked package, which object should a developer query using the Tooling API to list the packages it depends on?
A. InstalledPackage
B. PackageDependency
C. UnlockedPackageInfo
D. SubscriberPackageVersion

→ Work with the Lightning Map Component and Apex Inherited Sharing


Launch the org you’ll use for the hands-on challenge, then create the following custom object and two custom fields.

• Create a custom object that will be used to store information about the various towers in the western States that are owned by Out and About Communications.
  ○ Label: Tower
  ○ Plural Label: Towers

• Create a new custom field to establish a Master-Detail relationship between Tower and Account. Add the Towers related list to the Account page layout.
  ○ Field Label: State
  ○ Type: Master-Detail
  ○ Field Name: State
  ○ Child Relationship Name: Towers

• Create a new custom field to enter the latitude and longitude for the location of each Tower.
  ○ Field Label: Tower Location
  ○ Field Name: Tower_Location
  ○ Type: Geolocation
  ○ Latitude and Longitude Display Notation: Decimal
  ○ Decimal Places: 6

Now add some data.

• Create two new Account records to represent the regions (only the Name field is required).
  ○ Utah
  ○ Idaho

• Create four new Tower records
  ○ Name: Lightning Ridge
  ○ State: Utah
  ○ Latitude: 40.490684
  ○ Longitude: -110.908727

  ○ Name: Craters
  ○ State: Idaho
  ○ Latitude: 43.555375
  ○ Longitude: -113.70069

  ○ Name: Nuckols
  ○ State: Idaho
  ○ Latitude: 47.516694
  ○ Longitude: -115.939163

  ○ Name: Rainbow
  ○ State: Utah
  ○ Latitude: 37.060663
  ○ Longitude: -110.975708

You use the code blocks below to complete the challenge.


TowerMapUtilClass code block:
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 code block:
public with 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 Lightning component code block:
<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}" zoomLevel="5" markersTitle="{!v.markersTitle}"/>
     </aura:if>
</aura:component>

Controller code block:
({
     handleInit: function (component, event, helper) {
          helper.initHelper(component, event, helper);
     }
})

Helper code block:
({
     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);
     }
})