Thursday, October 17, 2019

Platform Developer I Certification Maintenance (Summer '19)

Unit : Platform Developer I Certification Maintenance (Summer '19)

UNIT : Learn What’s New for Platform Developers in Spring ’19:-

1. What allows Flows to manipulate complex data types that are often returned from calls to web services?
A. Screen components
B. Primitive Apex objects
C. Apex-defined data types
D. External service registrations

2. What is the benefit of using the Continuation class in Apex to make a long-running request to an external web service?
A. Multiple Continuation action calls can be made in parallel.
B. A single Continuation object can contain up to 10 callouts.
C. DML operations can be performed within the Continuation.
D. More long-running callouts can be made using Continuations.

3. Which Lightning web component configuration file tag set specifies the form factors that the component supports?
A. <targets>
B. <isExposed>
C. <supportedFormFactors>
D. <design:supportedFormFactors>


4. Which tag adds the Lightning Web Components for Visualforce JavaScript library to a Visualforce page?
A. <apex:include/>
B. <apex:lightning/>
C. <apex:includeLightning/>
D. <apex:createComponent/>.

UNIT : Get Hands-on using Platform Events from Batch Apex Classes
Step 1:- Install the below unmanaged package for completing this challenge.
Link:- https://login.salesforce.com/packaging/installPackage.apexp?p0=04t4P000002EMv0
👉Select Install for All Users, then click Install.
👉Once the installation is complete, click Done.
Step 2:- Modify an existing batch Apex job to raise BatchApexErrorEvents
👉Take an existing batch Apex job class and update it to implement the Database.RaisesPlatformEvents interface.
Then, add a trigger on BatchApexErrorEvent that logs exceptions in the batch job to a custom object.

👉Update the BatchLeadConvert class to implement the Database.RaisesPlatformEvents marker interface.
 public with sharing class BatchLeadConvert implements Database.Batchable<SObject>, Database.RaisesPlatformEvents{  
   private final String CONVERTED_STATUS = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1].MasterLabel;  
   public Database.QueryLocator start(Database.BatchableContext ctx){  
     return Database.getQueryLocator([SELECT Id FROM Lead WHERE ConvertedContactId = null]);  
   }  
   public void execute(Database.BatchableContext ctx, List<Lead> records){  
     List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();  
     for(Lead record:records){  
       Database.LeadConvert lc = new Database.LeadConvert();  
       lc.setConvertedStatus(CONVERTED_STATUS);  
       lc.setLeadId(record.Id);  
       leadConverts.add(lc);  
     }  
     Database.convertLead(leadConverts, true);  
   }  
   public void finish(Database.BatchableContext ctx){  
   }  
 }  
Step 3:-
👉Create an Apex trigger called BatchApexErrorTrigger on the BatchApexErrorEvent SObject type. For each event record, capture the following fields and save them to the corresponding fields in a new BatchLeadConvertErrors__c record.
AsyncApexJobId: AsyncApexJobId__c
JobScope: Records__c
StackTrace: StackTrace__c
To make the trigger bulk safe, use a single DML statement to insert a list of new records at the end.
 trigger BatchApexErrorTrigger on BatchApexErrorEvent (after insert) {  
   BatchLeadConvertErrors__c[] insertErrorList = new BatchLeadConvertErrors__c[]{};  
   for(BatchApexErrorEvent error : trigger.new)  
   {  
     BatchLeadConvertErrors__c errorLogs = new BatchLeadConvertErrors__c();  
     errorLogs.AsyncApexJobId__c = error.AsyncApexJobId;  
     errorLogs.Records__c = error.JobScope;  
     errorLogs.StackTrace__c = error.StackTrace;  
     insertErrorList.add(errorLogs);  
   }  
   insert insertErrorList;  
 }  
NOTE: BEFORE COMPLETING CHALLENGE, MAKE SURE YOU TO RUN THE BatchLeadConvertTest TEST CLASS


EmoticonEmoticon