Skip to content

Commit 926c699

Browse files
committed
Allowing to log SObject without ID field
1 parent 1adf4de commit 926c699

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,11 @@ global with sharing class LogEntryEventBuilder {
460460
this.logEntryEvent.RecordSObjectClassification__c = 'Unknown';
461461
this.logEntryEvent.RecordSObjectType__c = 'Unknown';
462462
} else {
463-
this.logEntryEvent.RecordId__c = record.Id;
463+
try {
464+
this.logEntryEvent.RecordId__c = record.Id;
465+
} catch (System.SObjectException ex) {
466+
// Certain SObjectTypes (such as Platform Events) do not have the ID field; that's OK, just skip setting it
467+
}
464468
this.logEntryEvent.RecordSObjectClassification__c = getSObjectClassification(record.getSObjectType());
465469
this.logEntryEvent.RecordSObjectType__c = record.getSObjectType().toString();
466470
this.logEntryEvent.RecordSObjectTypeNamespace__c = getSObjectTypeNamespace(record.getSObjectType());

0 commit comments

Comments
 (0)