salesforce资格维护之developer篇

salesforce资格维护之developer篇_第1张图片

salesforce资格认证后资格维护之developer篇Platform Developer I Certification Maintenance

salesforce资格维护之developer篇_第2张图片

admin比较简单,对照着trailhead一步一步操作就可以 我今天说developer初级的资格维护

题目很简单,对着trailhead,上文都有答案,主要说step2,实际操作!
Apex 一括処理クラスからのプラットフォームイベントの使用のハンズオン

要求如下:
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.

三步操作

salesforce资格维护之developer篇_第3张图片

  • 第一步,登录你自己的salesforce账号,点击起动。
    头像旁边的设置,user》user.
    勾选用户名为自己名字的用户,记录自己的用户名
    点击重置密码,ok
    去用户邮箱,两封邮件,一是重置密码连接,一是确认code
    点击重置密码连接,输入确认code,设置新密码
  • 第二步,
    https://login.salesforce.com/packaging/installPackage.apexp?p0=04t4P000002EMv0
    点击这个链接
    登录重置后的用户信息
    选全部user install , 稍等几分钟直到完了

第三步,分两个part给你们讲
Part 1,

  • 还是小人头旁边的设置,点开下面有 developer console,点进去
  • 打开 BatchLeadConvert Apex Batch Class
  • 只更新第一行 public with sharing class BatchLeadConvert implements Database.Batchable, Database.RaisesPlatformEvents{
    // 后面的不用管也不用动. }

Part 2,

  • 新建 trigger

名字:BatchApexErrorTrigger
文件:BatchApexErrorEvent

版本1```

> >   trigger BatchApexErrorTrigger on BatchApexErrorEvent (after insert) {
> >         list bcr= new List();
> >     
> >     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;
> >     }
> > 
> > }

版本2

trigger BatchApexErrorTrigger on BatchApexErrorEvent (after insert) {
    List List_LeadConvertError = new List();
    
    for(BatchApexErrorEvent event: trigger.new){
    	BatchLeadConvertErrors__c lcerror = new BatchLeadConvertErrors__c();
        lcerror.AsyncApexJobId__c = event.AsyncApexJobId;
        lcerror.Records__c = event.JobScope;
        lcerror.StackTrace__c = event.StackTrace;
        
        List_LeadConvertError.add(lcerror);
    }
    if(List_LeadConvertError.size() > 0 && List_LeadConvertError != null){
    	insert List_LeadConvertError;
    }
}

版本3

salesforce资格维护之developer篇_第4张图片

完了以后测试一下,我测试过程中有几次报错,但是中途休息几分钟后会成功,所以可能有延迟等问题。

最后,祝大家逢考必过!

你可能感兴趣的:(salesforce,developer)