Tuesday 24 September 2019

Platform Developer I Certification Maintenance (Summer '19)

1.What allows Flows to manipulate complex data types that are often returned from calls to web services?
A. Apex-defined data types
2.What is the benefit of using the Continuation class in Apex to make a long-running request to an external web service?
A. 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. <supportedFormFactors>
4.Which tag adds the Lightning Web Components for Visualforce JavaScript library to a Visualforce page?
A. <apex:includeLightning/>

step2

1.Select and copy this link: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t4P000002EMv0
2.In the incognito window, paste the link into the address bar to install the package.
3.On the Salesforce login screen that appears, enter the username and password for your Trailhead Playground, then click Log In.
4.Select Install for All Users, then click Install.
5.Once the installation is complete, click Done.
Apex code

/* batch class:-BatchLeadConvert  */
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){

    }
}

Trigger code
* write trigger on  BatchApexErrorEvent  object*/

trigger BatchApexErrorTrigger on BatchApexErrorEvent (after insert) {
 list<BatchLeadConvertErrors__c> bcr= new List<BatchLeadConvertErrors__c>();
   
    for(BatchApexErrorEvent event: trigger.new){
       
        BatchLeadConvertErrors__c  evrterror= new BatchLeadConvertErrors__c ();
       
        evrterror.AsyncApexJobId__c= event.AsyncApexJobId;
        evrterror.Records__c=event.JobScope;
        evrterror.StackTrace__c=event.StackTrace;   
        bcr.add(evrterror);   
    }
   
    if(bcr.size()>0){
       
        insert bcr;
    }

}

No comments: