• Swati Patel 28
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Platform Developer I Certification Maintenance (Summer '19)  Challenege code
********************************************************************************
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.

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) {
    
   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;
    }

}

*************************************************************
BatchLeadConvert Apex Batch Class

public with sharing class BatchLeadConvert implements Database.Batchable<SObject>, Database.RaisesPlatformEvents{

// Not be bothered whats here. Just Implement Raises Platform Events Interface.
}

 
I am trying to deploy the xml package for Customer_Interaction__b.object using the workbench for this unit. However I deploy and get success message in workbench but cannot see any big object.
  • I did see on the unit page it says that the examples are written for api unit 41.0 but my workbench doesnt allow me to go beyond 40. Does this matter?
  • My trailhead playground is on winter 18.
  • Does it matter what the file name for the object and permission set? (I do have the package.xml)
  • I have tried with and without having 'Single package' selected in workbench deploy
  • I have double checked the workbench is logged into the correct org
User-added image
User-added image




 
I am on the last module of the Build a Discount Calculator trail. I have verified the first 4 steps and received the 50 points (everything was configured correctly). Now, when I try to verify my last step I am getting the following error:

Challenge Not yet complete... here's what's wrong: 
The 'Calculate Discount' custom button doesn't exist or isn't properly configured. Check the instructions.

I've verfied the creation of the button, it's on the correct page layout and I've tested the button- it gives me the correct discount percentage and discounted amount.

Any other ideas on what I should check? I'm at a loss.

I read the thread titled "Create and enable a compact layout : Trailhead Challenge" and I thought that was my answer but I did the link to the Contact page correctly and I am still getting the error.  I have refreshed my developer version of Salesforce and I have refreshed my Salesforce1 app on my phone.  

CompactLayout1
The actual compact layout I built in the wizard but could not locate the place to set it as the default until I search by title and it was already set as default in teh Contact page.
Contact Compact Layout
Below is the screenshot from my phone showing the page layout is working properly.
Cell Phone Screen Shot of compact Layout

Any suggestions?
 

Sam