Tuesday, January 1, 2019

Platform Developer I Certification Maintenance (Winter '19) Challenge

Platform Developer I Certification Maintenance (Winter '19) Trailhead Challenge

After Creating the Tower object in the developer org add the four records mentioned in the trailhead challenge and copy the below code blocks to finish the challenge.

  • Copy the helper class code block, TowerMapUtilClass, from above and modify it so the sharing rules are enforced based on the sharing setting of the calling class.

    • 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);  
          }  
       }  
      
  • Copy the controller code block, TowerMapControllerClass, from above and modify it so the sharing rules are enforced.

    • 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;  
          }  
       }  
      
  • Copy and modify the Lightning component code above to implement a lightning:map component named Towermap. Replace the  with your code. Your code should pass the value of v.mapMarkers to the mapMarkers attribute, pass the value of v.markersTitle to the markersTitleattribute, and set the zoomLevel attribute to 5.

    • Towermap.cmp
    •  <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)}" >  
            <!-- Create lightning:map here -->  
            <lightning:map   
           mapMarkers="{! v.mapMarkers }"   
           zoomLevel="{!v.zoomLevel}" markersTitle="{!v.markersTitle}"/>  
          </aura:if>  
       </aura:component>  
      
  • Copy and paste the controller and helper code blocks above to create controller and helper functions to pull all Tower locations from the server.

    • TowermapController.js
    •  ({  
          handleInit: function (component, event, helper) {  
            helper.initHelper(component, event, helper);  
            component.set('v.zoomLevel', 5);  
          }  
       })  
      
    • TowermapHelper.js
    •  ({  
          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);  
          }  
       })  
      
  • To view your map, you can use Lightning App Builder to create a standalone one-column app page named Towers and add it to the Lightning Experience App Launcher. More experienced developers can chose another method to expose the component, if desired.
    • Setup ➤ Lightning App Builder ➤  Click "New" ➤  Select App Page ➤ Click Next ➤ Give Label as "Towers" ➤  Select "One Column" ➤  Select "Towermap" under the lightning components section and add the component to the lightning page
    • Save and activate the lightning page to display the page in the sales,service applications.

All the best..!😉

Saturday, April 14, 2018

How to get the key prefix of an Object in Salesforce

How to get the key prefix of an Object in Salesforce

We know there are two types of record-id are present in Salesforce.
  • 15 digit -- Case Sensitive
  • 18 digit -- Case Insensitive
Only 3 digits of ids represent object type.

For example :- 
  • Account - 001
  • Note      - 002
  • Contact - 003
  • Opportunities - 006
  • Lead  - 00Q
Q: How will get these prefix dynamically, I mean by using Apex code?

Ans: Schema.DescribeSObjectResult r = CustomObject__c.sObjectType.getDescribe();String keyPrefix = r.getKeyPrefix();System.debug('***ObjectKeyPrefix***'+keyPrefix );

It will print prefix of Custom Object id.

Other References



Wednesday, April 11, 2018

Salesforce Certified Platform Developer I – Spring ’18 Release Exam

Platform Developer I - Spring '18 Release Exam


1 of 5. What is the replacement that Salesforce recommends for Force.com IDE 2 Beta?

A.  Workbench.
B.  Developer Console.
C.  MavensMate for Sublime Text.
D.  Salesforce Extensions for VS code.

Reference

2 of 5. What can be used to control the styling and behavior of the Salesforce login process?

A.  Visaulforce page login flow.
B.  Lightning Component Login flow.
C.  Process Builder on login event.
D.  Quick Action on login event.

Reference

3 of 5. Which Salesforce command line interface (CLI) command supports the generation of new Apex triggers?

A.  force:schema:sobject: -t | createtrigger
B.  force:data:sobject:createtrigger
C.  force:trigger:new
D.  force:apex:trigger:create

Reference

4 of 5. Which global variable can be used to detect whether a Visualforce page is loaded in Lightning apps with console navigation or standard navigation?

A.  $Browser.formFactor.
B.  $UI.UserTheme.
C.  $Organization.UITheme.
D.  $User.UITheme.

Reference

5 of 5. Which debug type captures information related to accessing external objects with the Salesforce Connect cross-org and OData adapters?

A.  XDS_CONNECT.
B.  XDS_RESPONSE.
C.  XDS_OBJECT.
D.  XDS_REQUEST.

Reference

Saturday, November 25, 2017

Salesforce Certified Platform Developer I - Winter '18 Release Exam

Platform Developer I - Winter '18 Release Exam


1 of 6. In which two ways does Lightning Data Service (LDS) eliminate redundant server calls in Lightning Components?

Choose 2 answers

A.  LDS allows each component within an app to make independent, but concurrent, calls to perform CRUD operations on the same record data.
B.  LDS can be configured as a publisher hub with simple Apex code.
C.  LDS identifies requests that involve the same record data and sends a single shared data request that updates all relevant components.
D.  LDS acts as a publisher hub that notifies components of data changes.

Reference


2 of 6. In which two ways does Salesforce DX facilitate source-driven development?
Choose 2 answers

A.  Salesforce DX provides an integrated, end-to-end life cycle designed for high-performance agile development.
B.  Salesforce DX provides an efficient, end-to-end life cycle designed for waterfall development.
C.  Salesforce DX shifts the source of truth from the org to the version control system.
D.  Salesforce DX allows agile, local test runs.

Reference


3 of 6. Which Content Security Policy (CSP) configuration is required to access the Streaming API and call Apex methods from within a Lightning container component?

A.  CSP set to Lightning
B.  CSP set to custom
C.  CSP set to minimum
D.  CSP set to low

Reference

4 of 6. What is the correct annotation to indicate test classes that can run in parallel?

A.  @isTest(isParallel=true)
B.  @isTest
C.  @isTest(runParallel=true)
D.  @isTest(isParallelrun=true)

Reference

5 of 6. What are two valid scenarios for automatic recompilation of Apex classes?
 Choose 2 answers

A.  Specific Apex classes are automatically recompiled before completing a metadata deploy.
B.  All Apex classes are automatically recompiled before completing a metadata deploy.
C.  All Apex classes are automatically recompiled when Apex transactions are run.
D.  All Apex classes are automatically recompiled before a package is installed.

Reference

6 of 6. Which two statements are true regarding Lightning component JavaScript code validation?
Choose 2 answers

A.  Code validations can be temporariy disabled by setting the component version to API 40.0 or earlier.
B.  Code validations enforce all ESlint rules.
C.  Code validations are applied only to components set to API version 41.0 and later.
D.  The validation service ensures good software design and prevent bugs.
 Mark this item for later review.

Reference

Saturday, October 21, 2017

Salesforce Certified Platform Developer I – Spring ’17 Release Exam

Platform Developer 1 Spring 17  'Release Exam


1 of 7. Custom Lightning Record Pages can be assigned to which three items?
Choose 3 Answers

A. Record typesB. Apps
C. Profiles
D. Public groups
E. Roles

2 of 7. Which component type will display the details of the parent Account from a custom Lightning record page for the Contact object?

A. Parent object component.
B. Related record component.
C. Filter list component.
D. Hierarchy component.

3 of 7.Which three actions can be taken from the Global Actions Menu?
Choose 3 answers

A. Execute anonymous blocks of Apex code.
B. Launch a custom Canvas App.
C. Launch a custom Visualforce Page.
D. Launch a custom Lightning Component.
E. Post to a Chatter feed.

4 of 7. Which three types of content can shortcuts be created for using Favorites?Choose 3 answers

A. Chatter groups.
B. Dashboards.
C. Global actions.
D. Record home pages.
E. Custom tabs.

5 of 7.  Which two options are available to display detailed information about the status of an Apex batch job?
Choose 2 answers

A. Submitted by user.
B. Submitted date.
C. Heap size.
D. Elapsed time.

6 of 7. Which feature enables creating, updating and deleting records in other Salesforce orgs?

A. Salesforce Connect Cross-Org Adapter.
B. Database.WriteableObject Interface.
C. Lightning-to-Lightning Connector.
D. Apex Triggers for Writeable External Objects.

7 of 7. A Platform Developer wants to reference an image included in the Salesforce Lightning Design System from a Visualforce page.Which two references should be included in the page markup?
Choose 2 answers
A. < force:slds >
B. < apex:slds >
C. $Asset
D. $SLDS

Salesforce Certified Platform Developer I – Summer ’17 Release Exam

Platform Developer 1 Summer 17 Release Exam

1 of 5. 
What is Consideration for Locker Service Enablement? 
A. Locker Service is enabled for custom Lightning Components Implementing the interface force:enforceLockerService.
B. Locker Service is enabled for all custom Lightning Components with API version    40.0 or greater.
C. Locker Service is disabled for custom Lightning Components Implementing the interface force:ignoreLockerService. 
D. Locker Service is disabled for all custom Lightning Components, regardless of the API  Version.
2 of 5. 
What are two considerations when overriding standard actions?
Choose 2 answers
A. Overriding standard actions with a Lightning component applies only to Lightning experience and Salesforce1, but not to Salesforce Classic.
B. Overriding standard actions with Visualforce page applies only to Salesforce Classic and Lightning Experience, but not to Salesforce1.
C. Overriding standard actions with Visualforce page applies only to Salesforce Classic, Lightning Experience and Salesforce1.
D. Overriding standard actions with a Lightning component applies to Lightning experience, Salesforce1 and Salesforce Classic.
3 of 5. 
Which standard actions can be overridden with Lightning Components? 
A. View, Edit, New, Delete.
B. List, View, Edit, New
C. List, Edit, New, Delete
D. Tab, View, Edit, New
4 of 5. 
How do the CSS enhancements to the Lightning Design System improve the developer experience?
Choose 3 answers
A. Uppercase is used to distinguish from a custom class name.
B. Class Names are available in upper and lower case.
C. Class names are abbreviated to reduce code length.
D. Single dashes are used in class names to enable commenting.

5 of 5. 
How can a validity check be performed on a component?
A. cmp.get("v.isValid") != Null
B. cmp.get() != Null
C. cmp.get("v.isValid") == true
D. cmp.get() == true