You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks to @pankaj0509 and @codejester90 for suggesting this enhancement & providing some great feedback!
Core Unlocked Package Changes
This release resolves #655 by adding support for defining, setting, and mapping custom fields within Nebula Logger's data model. This is helpful in orgs that want to extend Nebula Logger's included data model by creating their own org/project-specific fields.
Adding custom fields to the platform event LogEntryEvent__e
To get started, the first step is to add a field to the platform LogEntryEvent__e`
Create your own custom fields on LogEntryEvent__e. Any data type supported by platform events can be used.
In this example, a custom text field called SomeCustomField__c has been added:
Populate your own custom fields in Apex by calling one of the two new instance methods on LogEntryEventBuilder:
For now, this functionality is available in Apex. Long-term, equivalent functionality will hopefully be added for Flow & Lightning Components. Here is an example of using the 2 new methods in Apex:
Logger.info('hello, world')
// Set a single field
.setField(LogEntryEvent__e.SomeCustomTextField__c, 'some text value')
// Set multiple fields
.setField(newMap<Schema.SObjectField, Object>{
LogEntryEvent__e.AnotherCustomTextField__c=>'another text value',
LogEntryEvent__e.SomeCustomDatetimeField__c=>System.now()
});
Adding custom fields to the custom objects Log__c, LogEntry__c, and LoggerScenario__c
If you want to store the data in one of Nebula Logger's custom objects, you can follow the above steps, and also...
Create an equivalent custom field on one of Nebula Logger's custom objects - right now, only Log__c, LogEntry__c, and LoggerScenario__c are supported.
In this example, a custom text field also called SomeCustomField__c has been added to Log__c object - this will be used to store the value of the field LogEntryEvent__e.SomeCustomField__c:
Create a record in the new CMDT LoggerFieldMapping__mdt to map the LogEntryEvent__e custom field to the custom object's custom field, shown below. Nebula Logger will automatically populate the custom object's target field with the value of the source LogEntryEvent__e field.
In this example, a custom text field called SomeCustomField__c has been added to both LogEntryEvent__e and Log__c.
New extra-tests Metadata
To help with testing Nebula Logger, a few new metadata items have been added to the extra-tests directory. This directory is not included in any of Nebula Logger's packages - its metadata is used to help both with automated tests in the pipeline, as well as manual functional tests.
Added some new custom fields for the objects LogEntryEvent__e, Log__c, LogEntry__c, and LoggerScenario__c to the extra-tests directory to provide sample fields that are only used for testing the custom field mapping functionality
Added some new CMDT records for the new object LoggerFieldMapping__mdt. These records map the (new) included custom fields (mentioned above)
enhancementNew feature or requestconfigurationsItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typelog managementItems related to the custom objects & Logger Console applogger engineItems related to the core logging engineunlocked packageIssues and enhancements that specifically apply to the unlocked packagecustom field mappingsItems related to custom field mappings functionality
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Thanks to @pankaj0509 and @codejester90 for suggesting this enhancement & providing some great feedback!
Core Unlocked Package Changes
This release resolves #655 by adding support for defining, setting, and mapping custom fields within Nebula Logger's data model. This is helpful in orgs that want to extend Nebula Logger's included data model by creating their own org/project-specific fields.
Adding custom fields to the platform event
LogEntryEvent__e
To get started, the first step is to add a field to the platform LogEntryEvent__e`
Create your own custom fields on
LogEntryEvent__e
. Any data type supported by platform events can be used.In this example, a custom text field called
SomeCustomField__c
has been added:Populate your own custom fields in Apex by calling one of the two new instance methods on
LogEntryEventBuilder
:setField(Schema.SObjectField field, Object fieldValue)
setField(Map<Schema.SObjectField, Object> fieldToValue)
For now, this functionality is available in Apex. Long-term, equivalent functionality will hopefully be added for Flow & Lightning Components. Here is an example of using the 2 new methods in Apex:
Adding custom fields to the custom objects
Log__c
,LogEntry__c
, andLoggerScenario__c
If you want to store the data in one of Nebula Logger's custom objects, you can follow the above steps, and also...
Create an equivalent custom field on one of Nebula Logger's custom objects - right now, only
Log__c
,LogEntry__c
, andLoggerScenario__c
are supported.In this example, a custom text field also called
SomeCustomField__c
has been added toLog__c
object - this will be used to store the value of the fieldLogEntryEvent__e.SomeCustomField__c
:Create a record in the new CMDT
LoggerFieldMapping__mdt
to map theLogEntryEvent__e
custom field to the custom object's custom field, shown below. Nebula Logger will automatically populate the custom object's target field with the value of the sourceLogEntryEvent__e
field.In this example, a custom text field called
SomeCustomField__c
has been added to bothLogEntryEvent__e
andLog__c
.New
extra-tests
MetadataTo help with testing Nebula Logger, a few new metadata items have been added to the
extra-tests
directory. This directory is not included in any of Nebula Logger's packages - its metadata is used to help both with automated tests in the pipeline, as well as manual functional tests.LogEntryEvent__e
,Log__c
,LogEntry__c
, andLoggerScenario__c
to theextra-tests
directory to provide sample fields that are only used for testing the custom field mapping functionalityLoggerFieldMapping__mdt
. These records map the (new) included custom fields (mentioned above)Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.13.13...v4.13.14
sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015oE2QAI
sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000015oE2QAI
This discussion was created from the release Custom Field Mappings Support.
Beta Was this translation helpful? Give feedback.
All reactions