Salesforce 需要访问Apex触发器中的托管包对象和字段

Salesforce 需要访问Apex触发器中的托管包对象和字段,salesforce,apex-code,apex,salesforce-service-cloud,salesforce-chatter,Salesforce,Apex Code,Apex,Salesforce Service Cloud,Salesforce Chatter,我必须在托管打包安装的对象上编写一个apex触发器,并在字段中访问apex触发器中的新旧值 请看下面我在这里使用的代码: trigger EmailScoreCalculator on sendgrid4sf__SendGrid_Email_Status__c (after update ) { sendgrid4sf__SendGrid_Email_Status__c oldOpp = Trigger.oldMap.get(sendgrid4sf__SendGrid_Ema

我必须在托管打包安装的对象上编写一个apex触发器,并在字段中访问apex触发器中的新旧值

请看下面我在这里使用的代码:

trigger EmailScoreCalculator on sendgrid4sf__SendGrid_Email_Status__c (after        update ) {

 sendgrid4sf__SendGrid_Email_Status__c  oldOpp = Trigger.oldMap.get(sendgrid4sf__SendGrid_Email_Status__c.Id);
对象名称:sendgrid4sf__SendGrid_电子邮件_状态__c(从管理包安装的对象)

但我在映射错误中获取无效密钥:

请建议是因为管理包对象还是我在这里做的任何错误,谢谢


注意:我无法在workbench中看到对象“sendgrid4sf\uuuuu SendGrid\u Email\u Status\uuuuu c”。

能否使用Trigger.old.keySet()获取所有键,然后遍历键列表并访问特定键的值。 据我所知,我们不能使用ObjectName.Id访问任何记录的Id。 所以我认为你们在线路上犯了错误

sendgrid4sf\uuuuu SendGrid\u Email\u Status\uuuu c oldOpp=Trigger.oldMap.get(sendgrid4sf\uuuu SendGrid\u Email\u Status\uu c.Id)

因此,如果要访问旧映射中的所有值,请使用以下命令

for(字符串recordId:Trigger.oldMap.keySet()){

sendgrid4sf\uuuuu SendGrid\u Email\u Status\uuuuuu c oldOpp=Trigger.oldMap.get(recordId)

}


希望这能有所帮助。

Bingo.谢谢Shankar这是我在那里犯的错误,谢谢你的帮助。。