1.What allows Flows to manipulate complex data types that are often returned from
calls to web services?
Answer:Apex Defined Data type
2. What is the benefit of using the Continuation class in Apex to make a long-running
request to an external web service?
ANS: more long-running callouts can be using as Continution
3. Which Lightning web component configuration file tag set specifies the form factors
that the component supports?
Ans: supportedFormFactors
4. Which tag adds the Lightning Web Components for Visualforce JavaScript library to a
Visualforce page?
Ans: <apex:includeLightning/>
Exercise :
calls to web services?
Answer:Apex Defined Data type
2. What is the benefit of using the Continuation class in Apex to make a long-running
request to an external web service?
ANS: more long-running callouts can be using as Continution
3. Which Lightning web component configuration file tag set specifies the form factors
that the component supports?
Ans: supportedFormFactors
4. Which tag adds the Lightning Web Components for Visualforce JavaScript library to a
Visualforce page?
Ans: <apex:includeLightning/>
Exercise :
- Click this link: install Package
- Update the BatchLeadConvert class to implement the Database.RaisesPlatformEvents marker interface. See below Example :
public with sharing class BatchLeadConvert implements
Database.Batchable<SObject>, Database.RaisesPlatformEvents {
// class implementation
}
- Write a trigger on BatchApexErrorEvent object;
- you can copy paste the below code in your trigger.
trigger BatchApexErrorTrigger on BatchApexErrorEvent (after insert) {
list<BatchLeadConvertErrors__c> listBatchData = new list<BatchLeadConvertErrors__c>();
for(BatchApexErrorEvent logData:trigger.new){
BatchLeadConvertErrors__c newBatchTest = new BatchLeadConvertErrors__c();
newBatchTest.AsyncApexJobId__c = logData.AsyncApexJobId;
newBatchTest.Records__c = logData.JobScope;
newBatchTest.StackTrace__c = logData.StackTrace;
listBatchData.add(newBatchTest);
}
insert listBatchData;
}
I am not able to install package in Playground Org.
ReplyDeleteInstall package is only install in dev org not in Playground Org.
You need to install it to your org.
DeleteThanks Buddy. Without this I would be scratching my head for a long time.
ReplyDeleteCan you please share your contact details. I may have a business opportunity for you in Salesforce.
ReplyDeletedrajtomar@gmail.com
DeleteI've provided my contact details just check it on the left hand side menu icon. You'll find all the details.
ReplyDeleteMethod does not exist or incorrect signature: void startTest() from the type test BatchLeadConvertTest: Method does not exist or incorrect signature: void startTest() from the type test
ReplyDeleteMethod does not exist or incorrect signature: void stopTest() from the type test BatchLeadConvertTest: Method does not exist or incorrect signature: void stopTest() from the type test
Method does not exist or incorrect signature: void getEventBus() from the type test
I am getting the error. Do you have any idea?
Check the syntax just replace your test class with the following code :
Delete@isTest
public class BatchLeadConvertTest {
@isTest
static void sanity(){
Lead l = new Lead(
FirstName = 'Bobby',
LastName = 'Bobson',
Company = 'Salesforce'
);
insert l;
BatchLeadConvert job = new BatchLeadConvert();
Test.startTest();
Id jobId = Database.executeBatch(job);
Test.stopTest();
System.assertEquals(0, [SELECT NumberOfErrors FROM AsyncApexJob WHERE Id = :jobId].NumberOfErrors);
}
@isTest
static void customObjectCreatedFromEventTrigger(){
if(!isUpdatedForEvents()){
return;
}
Lead errLead = new Lead(
LastName = 'Astro DoNotConvert',
Company = 'Trailhead'
);
insert errLead;
BatchLeadConvert job = new BatchLeadConvert();
Test.startTest();
Id jobId = Database.executeBatch(job);
try{
Test.stopTest();
}catch(DmlException ex){ /* don't fail this test if there were errors in the batch job - we want that */ }
Test.getEventBus().deliver();
List errorLogs = [SELECT id, StackTrace__c, Records__c FROM BatchLeadConvertErrors__c];
System.assertEquals(1, errorLogs.size(), 'Expected errors converting DoNotConvertLeads');
System.assert(errorLogs[0].Records__c.contains(errLead.Id), 'Expected "Astro DoNotConvert" Lead to fail to convert');
}
static Boolean isUpdatedForEvents(){
ApexClass cls = [SELECT Body FROM ApexClass WHERE Name = 'BatchLeadConvert'];
return cls.body.containsIgnoreCase('Database.RaisesPlatformEvents');
}
}
This comment has been removed by the author.
DeleteThis test class covered the apex class but not trigger. Could you help me for covering this pd1 maintenance
DeleteI am getting the following error
ReplyDeleteWhen executed, the BatchLeadConvertTest test class has test failures. All tests should pass.
I have done everything as u sggested.
Hi Devraj,
ReplyDeleteI won't be able to instal the package in my ORG and i am getting the above mentioned error. Please help.
Where have you posted your error?
DeleteChallenge not yet complete in My Trailhead Playground 1
ReplyDeleteVerify the 'implements' list on BatchLeadConvert includes 'Database.RaisesPlatformEvents'
I've done above all steps and still i'm getting this error. Could you please help out me on this.
Verify your first line with the below lines.... It should be same...
Deletepublic with sharing class BatchLeadConvert implements
Database.Batchable, Database.RaisesPlatformEvents {...}
I am not able to find BatchApexErrorEvent object.
ReplyDeletegot it, it is not showing on UI, we need to check on developer console. Thanks
Delete@Devraj Can you please help me. I am getting the error in the test class and i have not made any changes to the test class.
ReplyDeleteWhen executed, the BatchLeadConvertTest test class has test failures. All tests should pass.
Send me your credential on drajtomar@gmail.com i'll do. Or i'll send zip to replace your all existing classes.
DeleteHi Devraj,
Deleteplease help me. I am getting the error in the test class and i have not made any changes to the test class.
When executed, the BatchLeadConvertTest test class has test failures. All tests should pass
Hello Shivangi ,
ReplyDeleteBatchApexErrorEvent values are not correctly assigned to BatchLeadConvertErrors__c fields in your trigger .
In trigger , most probably you have assigned Records__c to RequestId but it should be assigned to JobScope .
You may replace your trigger code by below lines of code :
trigger BatchApexErrorTrigger on BatchApexErrorEvent (after insert) {
list leadConvertErrorList = new list();
for (BatchApexErrorEvent e : trigger.new) {
leadConvertErrorList.add(new BatchLeadConvertErrors__c(AsyncApexJobId__c=e.AsyncApexJobId,Records__c=e.JobScope,StackTrace__c=e.StackTrace));
}
system.debug('*****leadConvertErrorList ***'+leadConvertErrorList);
if (leadConvertErrorList.size() > 0 ) {
Insert leadConvertErrorList;
}
}
Hi Devraj
ReplyDeleteI cannot install the package, Getting this error
Illegal assignment from List to ApexClass BatchLeadConvertTest: Illegal assignment from List to ApexClass
Variable does not exist: body BatchLeadConvertTest: Variable does not exist: body
This might be because of the existing changes in your org...
DeleteThis comment has been removed by the author.
ReplyDelete@Devraj Can you please help me. I am getting the error in the test class and i have not made any changes to the test class.
ReplyDeleteWhen executed, the BatchLeadConvertTest test class has test failures. All tests should pass.
I am Getting the same error when I execute the code, please can you help me ?
i am getting this error after i created Apex trigger,
ReplyDeleteNo Apex Trigger named 'BatchApexErrorTrigger' was found.
Hello, I have an invalid type error on BatchLeadConvertErrors in BatchApexErrorTrigger. Please could you help me?
ReplyDeleteHi,
ReplyDeleteI am not able to find the object "BatchApexErrorEvent" in Objects.. There is no New Trigger option also to write the trigger. My developer console page is also not opening. It keeps loading and the page crashes. :( :(
Can anyone help ? I am not able to write the trigger.
Thanks
Hi,
ReplyDeleteSame problem- I am not able to find the object "BatchApexErrorEvent" in Objects..
Did u get anything?
Verify your playground App and the app attached with your Trail-head. I know i'm replying late so sorry.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI got passed in the Platform Developer I (WI20) (PDI) exam recently. I am here to share my experiences and study resources related to this exam.
ReplyDeleteThere are many free and paid study resources on the internet to help you practice and pass the Platform Developer I (WI20) exam.
few resources that I personally used to prepare myself is valid practice material like up-to-date PDI exam training questions, reading community reviews and discussions regarding exam experience of different candidates will be helpful.
https://www.dumpsforsales.com/product/PDI-dumps-pdf/