Custom Field Mappings Support for Lightning Components
Core Unlocked Package Changes
Resolved #718 by adding the ability to set custom fields on a log entry in JavaScript (lightning components), using a new function setField()
in logEntryBuilder.js
. This is the JavaScript equivalent to the Apex method overloads setField()
in LogEntryEventBuilder.cls
that were introduced in release v4.13.14
.
-
To use the new
setField()
function, pass an object as the function's single parameter. The object should contain the custom fields onLogEntryEvent__e
that you want to set, along with their corresponding values. For example:{ SomeField__c": "some value", "AnotherField__c": "another value" }
import { createLogger } from "c/logger"; export default class LoggerCustomFieldDemo extends LightningElement { logger; async connectedCallback() { this.logger = await createLogger(); this.logger.info("Hello, world! This log entry has 2 custom fields set.") .setField({ SomeCustomTextField__c: "some text value", SomeCustomNumberField__c: 123, }); this.logger.debug("Hello again, world! This log entry has 1 other custom field set.") .setField({ AnotherCustomTextField__c: "another text value", }); this.logger.saveLog(); } }
Note
The code above only highlights the new functionality that is now available when logging in lightning components. For more info on how to fully set up custom field mappings, see this section in README.md.
Recipes Metadata Changes
- Updated the demo lighting components in the recipes metadata folder to set a custom field on
LogEntry__c
. This provides a quick & easy way to verify that the functionality works for lightning components.
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.14.5...v4.14.6
- SF CLI:
sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015oRhQAI
- SFDX CLI:
sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000015oRhQAI
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015oRhQAI
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015oRhQAI