Skip to content

Commit

Permalink
Double Feature: OmniStudio logging + loosely-coupled dependencies (#765)
Browse files Browse the repository at this point in the history
* Added new CallableLogger class that can be used both for a loosely coupled dependency on Nebula Logger, as well as for adding support for logging in OmniStudio

* Added logic to populate origin source metadata fields on LogEntry__c for OmniStudio entries (similar to how fields are populated for Apex, Flow, and lightning components)

* Fixed #764 in the Slack plugin by correcting the logic for the 'isShort' boolean, used to determine how to format long text blocks & blocks with line breaks

* Expanded build.yml to run all scratch org def files (which were also renamed), added sample OmniStudio metadata to use in the pipeline (for orgs with OmniStudio configured)

* Cleaned up README.md content / started the process of consolidating documentation to be centralized in the wiki
  • Loading branch information
jongpie authored Sep 17, 2024
1 parent ff06c25 commit 1629291
Show file tree
Hide file tree
Showing 165 changed files with 1,890 additions and 166 deletions.
298 changes: 238 additions & 60 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions .mob

This file was deleted.

140 changes: 88 additions & 52 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/linters/lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
'sfdx-project.json': () => {
return `npm run package:version:number:fix`;
},
'*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}': filenames => filenames.map(filename => `prettier --write '${filename}'`),
'*.{apex,cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}': filenames => filenames.map(filename => `prettier --write '${filename}'`),
'**/lwc/**': filenames => {
return [`eslint --config ./config/linters/.eslintrc.json ${filenames.join(' ')} --fix`];
// FIXME this command should only run tests for the changed LWCs (instead of running tests for all LWCs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"orgName": "Nebula Logger - Dev Scratch Org",
"orgName": "Nebula Logger - Advanced Scratch Org",
"edition": "Enterprise",
"hasSampleData": true,
"country": "US",
"language": "en_US",
"features": ["EinsteinGPTPlatform", "EventLogFile", "PlatformCache"],
"features": ["Communities", "EinsteinGPTPlatform", "EventLogFile", "OmniStudioDesigner", "OmniStudioMetadata", "OmniStudioRuntime", "PlatformCache"],
"settings": {
"apexSettings": {
"enableAuraApexCtrlAuthUserAccessCheckPref": true,
"enableAuraApexCtrlGuestUserAccessCheckPref": true,
"enableCompileOnDeploy": true,
"enableRestrictCommunityExecAnon": true,
"enableSecureNoArgConstructorPref": true
},
Expand All @@ -19,12 +18,18 @@
"communitiesSettings": {
"enableNetworksEnabled": true
},
"emailAdministrationSettings": {
"enableEnhancedEmailEnabled": true
},
"eventSettings": {
"enableDeleteMonitoringData": true,
"enableEventLogGeneration": true,
"enableLightningLoggerEvents": true,
"eventLogRetentionDuration": 30
},
"experienceBundleSettings": {
"enableExperienceBundleMetadata": true
},
"flowSettings": {
"canDebugFlowAsAnotherUser": true
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"orgName": "Nebula Logger - Build - Base Scratch Org",
"orgName": "Nebula Logger - Base Scratch Org",
"edition": "Enterprise",
"hasSampleData": true,
"country": "US",
Expand All @@ -12,6 +12,9 @@
"communitiesSettings": {
"enableNetworksEnabled": false
},
"emailAdministrationSettings": {
"enableEnhancedEmailEnabled": false
},
"eventSettings": {
"enableDeleteMonitoringData": false,
"enableEventLogGeneration": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"orgName": "Nebula Logger - Build - Event Monitoring Scratch Org",
"orgName": "Nebula Logger - Event Monitoring Scratch Org",
"edition": "Enterprise",
"hasSampleData": true,
"country": "AU",
Expand All @@ -12,6 +12,9 @@
"communitiesSettings": {
"enableNetworksEnabled": false
},
"emailAdministrationSettings": {
"enableEnhancedEmailEnabled": false
},
"eventSettings": {
"enableDeleteMonitoringData": true,
"enableEventLogGeneration": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"orgName": "Nebula Logger - Build - Experience Cloud Scratch Org",
"orgName": "Nebula Logger - Experience Cloud Scratch Org",
"edition": "Enterprise",
"hasSampleData": true,
"country": "ES",
Expand All @@ -12,6 +12,9 @@
"communitiesSettings": {
"enableNetworksEnabled": true
},
"emailAdministrationSettings": {
"enableEnhancedEmailEnabled": false
},
"eventSettings": {
"enableDeleteMonitoringData": false,
"enableEventLogGeneration": false,
Expand Down
27 changes: 27 additions & 0 deletions config/scratch-orgs/omnistudio-scratch-def.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"orgName": "Nebula Logger - OmniStudio Scratch Org",
"edition": "Enterprise",
"hasSampleData": true,
"country": "US",
"language": "en_US",
"features": ["OmniStudioDesigner", "OmniStudioMetadata", "OmniStudioRuntime"],
"settings": {
"chatterSettings": {
"enableChatter": false
},
"communitiesSettings": {
"enableNetworksEnabled": false
},
"emailAdministrationSettings": {
"enableEnhancedEmailEnabled": true
},
"eventSettings": {
"enableDeleteMonitoringData": false,
"enableEventLogGeneration": false,
"eventLogRetentionDuration": 0
},
"pathAssistantSettings": {
"pathAssistantEnabled": false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<OmniIntegrationProcedure xmlns="http://soap.sforce.com/2006/04/metadata">
<customJavaScript>{}</customJavaScript>
<elementTypeComponentMapping>{&quot;ElementTypeToHTMLTemplateList&quot;:[]}</elementTypeComponentMapping>
<isActive>false</isActive>
<isIntegrationProcedure>true</isIntegrationProcedure>
<isMetadataCacheDisabled>false</isMetadataCacheDisabled>
<isOmniScriptEmbeddable>false</isOmniScriptEmbeddable>
<isTestProcedure>false</isTestProcedure>
<isWebCompEnabled>false</isWebCompEnabled>
<language>Procedure</language>
<name>Logger Integration Procedure Demo</name>
<omniProcessElements>
<isActive>true</isActive>
<isOmniScriptEmbeddable>false</isOmniScriptEmbeddable>
<level>0.0</level>
<name>AddLogEntry</name>
<omniProcessVersionNumber>0.0</omniProcessVersionNumber>
<propertySetConfig>{
&quot;executionConditionalFormula&quot; : &quot;&quot;,
&quot;failureConditionalFormula&quot; : &quot;&quot;,
&quot;failOnStepError&quot; : true,
&quot;useFormulas&quot; : true,
&quot;additionalInput&quot; : {
&quot;loggingLevel&quot; : &quot;INFO&quot;,
&quot;message&quot; : &quot;Hello, world!&quot;
},
&quot;additionalOutput&quot; : { },
&quot;failureResponse&quot; : { },
&quot;sendOnlyAdditionalInput&quot; : false,
&quot;returnOnlyAdditionalOutput&quot; : false,
&quot;returnOnlyFailureResponse&quot; : false,
&quot;responseJSONPath&quot; : &quot;&quot;,
&quot;responseJSONNode&quot; : &quot;&quot;,
&quot;sendJSONPath&quot; : &quot;&quot;,
&quot;sendJSONNode&quot; : &quot;&quot;,
&quot;remoteClass&quot; : &quot;CallableLogger&quot;,
&quot;remoteOptions&quot; : { },
&quot;remoteMethod&quot; : &quot;newEntry&quot;,
&quot;chainOnStep&quot; : false,
&quot;actionMessage&quot; : &quot;&quot;,
&quot;additionalChainableResponse&quot; : { },
&quot;show&quot; : null,
&quot;label&quot; : &quot;RemoteAction1&quot;,
&quot;disOnTplt&quot; : false
}</propertySetConfig>
<sequenceNumber>1.0</sequenceNumber>
<type>Remote Action</type>
</omniProcessElements>
<omniProcessKey>demo_Logging</omniProcessKey>
<omniProcessType>Integration Procedure</omniProcessType>
<propertySetConfig>{
&quot;linkToExternalObject&quot; : &quot;&quot;,
&quot;trackingCustomData&quot; : { },
&quot;includeAllActionsInResponse&quot; : false,
&quot;columnsPropertyMap&quot; : [ ],
&quot;relationshipFieldsMap&quot; : [ ],
&quot;labelSingular&quot; : &quot;&quot;,
&quot;labelPlural&quot; : &quot;&quot;,
&quot;description&quot; : &quot;&quot;,
&quot;nameColumn&quot; : &quot;&quot;,
&quot;rollbackOnError&quot; : false,
&quot;chainableQueriesLimit&quot; : 50,
&quot;chainableDMLStatementsLimit&quot; : null,
&quot;chainableCpuLimit&quot; : 2000,
&quot;chainableHeapSizeLimit&quot; : null,
&quot;chainableDMLRowsLimit&quot; : null,
&quot;chainableQueryRowsLimit&quot; : null,
&quot;chainableSoslQueriesLimit&quot; : null,
&quot;chainableActualTimeLimit&quot; : null,
&quot;additionalChainableResponse&quot; : { },
&quot;queueableChainableQueriesLimit&quot; : 120,
&quot;queueableChainableCpuLimit&quot; : 40000,
&quot;queueableChainableHeapSizeLimit&quot; : 6,
&quot;ttlMinutes&quot; : 5,
&quot;mockResponseMap&quot; : { }
}</propertySetConfig>
<subType>Logging</subType>
<type>demo</type>
<uniqueName>demo_Logging_Procedure_1</uniqueName>
<versionNumber>1.0</versionNumber>
</OmniIntegrationProcedure>
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<OmniScript xmlns="http://soap.sforce.com/2006/04/metadata">
<elementTypeComponentMapping>{&quot;ElementTypeToHTMLTemplateList&quot;:[]}</elementTypeComponentMapping>
<isActive>true</isActive>
<isIntegrationProcedure>false</isIntegrationProcedure>
<isMetadataCacheDisabled>false</isMetadataCacheDisabled>
<isOmniScriptEmbeddable>false</isOmniScriptEmbeddable>
<isTestProcedure>false</isTestProcedure>
<isWebCompEnabled>true</isWebCompEnabled>
<language>English</language>
<name>Nebula Logger Demo</name>
<omniProcessElements>
<isActive>false</isActive>
<isOmniScriptEmbeddable>false</isOmniScriptEmbeddable>
<level>0.0</level>
<name>Add New Log Entry with Integration Procedure Action</name>
<omniProcessVersionNumber>0.0</omniProcessVersionNumber>
<propertySetConfig>{
&quot;controlWidth&quot; : 12,
&quot;label&quot; : &quot;&quot;,
&quot;integrationProcedureKey&quot; : &quot;&quot;,
&quot;useContinuation&quot; : false,
&quot;remoteOptions&quot; : {
&quot;preTransformBundle&quot; : &quot;&quot;,
&quot;postTransformBundle&quot; : &quot;&quot;,
&quot;useFuture&quot; : false,
&quot;chainable&quot; : false
},
&quot;remoteTimeout&quot; : 30000,
&quot;preTransformBundle&quot; : &quot;&quot;,
&quot;postTransformBundle&quot; : &quot;&quot;,
&quot;sendJSONPath&quot; : &quot;&quot;,
&quot;sendJSONNode&quot; : &quot;&quot;,
&quot;responseJSONPath&quot; : &quot;&quot;,
&quot;responseJSONNode&quot; : &quot;&quot;,
&quot;extraPayload&quot; : {
&quot;loggingLevel&quot; : &quot;DEBUG&quot;,
&quot;message&quot; : &quot;halp&quot;
},
&quot;inProgressMessage&quot; : &quot;In Progress&quot;,
&quot;postMessage&quot; : &quot;Done&quot;,
&quot;failureNextLabel&quot; : &quot;Continue&quot;,
&quot;failureAbortLabel&quot; : &quot;Abort&quot;,
&quot;failureGoBackLabel&quot; : &quot;Go Back&quot;,
&quot;failureAbortMessage&quot; : &quot;Are you sure?&quot;,
&quot;validationRequired&quot; : &quot;Step&quot;,
&quot;redirectPageName&quot; : &quot;&quot;,
&quot;redirectTemplateUrl&quot; : &quot;vlcAcknowledge.html&quot;,
&quot;redirectNextLabel&quot; : &quot;Next&quot;,
&quot;redirectNextWidth&quot; : 3,
&quot;redirectPreviousLabel&quot; : &quot;Previous&quot;,
&quot;redirectPreviousWidth&quot; : 3,
&quot;showPersistentComponent&quot; : [ true, false ],
&quot;show&quot; : null,
&quot;HTMLTemplateId&quot; : &quot;&quot;,
&quot;wpm&quot; : false,
&quot;ssm&quot; : false,
&quot;message&quot; : { },
&quot;pubsub&quot; : false,
&quot;svgSprite&quot; : &quot;&quot;,
&quot;svgIcon&quot; : &quot;&quot;,
&quot;errorMessage&quot; : {
&quot;custom&quot; : [ ],
&quot;default&quot; : null
},
&quot;enableDefaultAbort&quot; : false,
&quot;enableActionMessage&quot; : false,
&quot;businessCategory&quot; : &quot;&quot;,
&quot;businessEvent&quot; : &quot;&quot;
}</propertySetConfig>
<sequenceNumber>1.0</sequenceNumber>
<type>Integration Procedure Action</type>
</omniProcessElements>
<omniProcessElements>
<isActive>true</isActive>
<isOmniScriptEmbeddable>false</isOmniScriptEmbeddable>
<level>0.0</level>
<name>Add New Log Entry with Remote Action</name>
<omniProcessVersionNumber>0.0</omniProcessVersionNumber>
<propertySetConfig>{
&quot;controlWidth&quot; : 12,
&quot;label&quot; : &quot;&quot;,
&quot;remoteClass&quot; : &quot;CallableLogger&quot;,
&quot;remoteMethod&quot; : &quot;newEntry&quot;,
&quot;remoteOptions&quot; : {
&quot;preTransformBundle&quot; : &quot;&quot;,
&quot;postTransformBundle&quot; : &quot;&quot;
},
&quot;remoteTimeout&quot; : 30000,
&quot;preTransformBundle&quot; : &quot;&quot;,
&quot;postTransformBundle&quot; : &quot;&quot;,
&quot;sendJSONPath&quot; : &quot;&quot;,
&quot;sendJSONNode&quot; : &quot;&quot;,
&quot;responseJSONPath&quot; : &quot;&quot;,
&quot;responseJSONNode&quot; : &quot;&quot;,
&quot;extraPayload&quot; : {
&quot;loggingLevel&quot; : &quot;WARN&quot;,
&quot;message&quot; : &quot;hi?&quot;,
&quot;saveLog&quot; : true
},
&quot;inProgressMessage&quot; : &quot;In Progress&quot;,
&quot;postMessage&quot; : &quot;Done&quot;,
&quot;failureNextLabel&quot; : &quot;Continue&quot;,
&quot;failureAbortLabel&quot; : &quot;Abort&quot;,
&quot;failureGoBackLabel&quot; : &quot;Go Back&quot;,
&quot;failureAbortMessage&quot; : &quot;Are you sure?&quot;,
&quot;validationRequired&quot; : &quot;Step&quot;,
&quot;redirectPageName&quot; : &quot;&quot;,
&quot;redirectTemplateUrl&quot; : &quot;vlcAcknowledge.html&quot;,
&quot;redirectNextLabel&quot; : &quot;Next&quot;,
&quot;redirectNextWidth&quot; : 3,
&quot;redirectPreviousLabel&quot; : &quot;Previous&quot;,
&quot;redirectPreviousWidth&quot; : 3,
&quot;showPersistentComponent&quot; : [ true, false ],
&quot;show&quot; : null,
&quot;HTMLTemplateId&quot; : &quot;&quot;,
&quot;wpm&quot; : false,
&quot;ssm&quot; : false,
&quot;message&quot; : { },
&quot;pubsub&quot; : false,
&quot;svgSprite&quot; : &quot;&quot;,
&quot;svgIcon&quot; : &quot;&quot;,
&quot;errorMessage&quot; : {
&quot;custom&quot; : [ ],
&quot;default&quot; : null
},
&quot;enableDefaultAbort&quot; : false,
&quot;enableActionMessage&quot; : false,
&quot;useContinuation&quot; : false,
&quot;businessCategory&quot; : &quot;&quot;,
&quot;businessEvent&quot; : &quot;&quot;,
&quot;toastComplete&quot; : true
}</propertySetConfig>
<sequenceNumber>0.0</sequenceNumber>
<type>Remote Action</type>
</omniProcessElements>
<omniProcessType>OmniScript</omniProcessType>
<propertySetConfig>{&quot;persistentComponent&quot;:[{&quot;render&quot;:false,&quot;label&quot;:&quot;&quot;,&quot;remoteClass&quot;:&quot;&quot;,&quot;remoteMethod&quot;:&quot;&quot;,&quot;remoteTimeout&quot;:30000,&quot;remoteOptions&quot;:{&quot;preTransformBundle&quot;:&quot;&quot;,&quot;postTransformBundle&quot;:&quot;&quot;},&quot;preTransformBundle&quot;:&quot;&quot;,&quot;postTransformBundle&quot;:&quot;&quot;,&quot;sendJSONPath&quot;:&quot;&quot;,&quot;sendJSONNode&quot;:&quot;&quot;,&quot;responseJSONPath&quot;:&quot;&quot;,&quot;responseJSONNode&quot;:&quot;&quot;,&quot;id&quot;:&quot;vlcCart&quot;,&quot;itemsKey&quot;:&quot;cartItems&quot;,&quot;modalConfigurationSetting&quot;:{&quot;modalHTMLTemplateId&quot;:&quot;vlcProductConfig.html&quot;,&quot;modalController&quot;:&quot;ModalProductCtrl&quot;,&quot;modalSize&quot;:&quot;lg&quot;}},{&quot;render&quot;:false,&quot;dispOutsideOmni&quot;:false,&quot;label&quot;:&quot;&quot;,&quot;remoteClass&quot;:&quot;&quot;,&quot;remoteMethod&quot;:&quot;&quot;,&quot;remoteTimeout&quot;:30000,&quot;remoteOptions&quot;:{&quot;preTransformBundle&quot;:&quot;&quot;,&quot;postTransformBundle&quot;:&quot;&quot;},&quot;preTransformBundle&quot;:&quot;&quot;,&quot;postTransformBundle&quot;:&quot;&quot;,&quot;id&quot;:&quot;vlcKnowledge&quot;,&quot;itemsKey&quot;:&quot;knowledgeItems&quot;,&quot;modalConfigurationSetting&quot;:{&quot;modalHTMLTemplateId&quot;:&quot;&quot;,&quot;modalController&quot;:&quot;&quot;,&quot;modalSize&quot;:&quot;lg&quot;}}],&quot;allowSaveForLater&quot;:true,&quot;saveNameTemplate&quot;:null,&quot;saveExpireInDays&quot;:null,&quot;saveForLaterRedirectPageName&quot;:&quot;sflRedirect&quot;,&quot;saveForLaterRedirectTemplateUrl&quot;:&quot;vlcSaveForLaterAcknowledge.html&quot;,&quot;saveContentEncoded&quot;:false,&quot;saveObjectId&quot;:&quot;%ContextId%&quot;,&quot;saveURLPatterns&quot;:{},&quot;autoSaveOnStepNext&quot;:false,&quot;elementTypeToHTMLTemplateMapping&quot;:{},&quot;seedDataJSON&quot;:{},&quot;trackingCustomData&quot;:{},&quot;enableKnowledge&quot;:false,&quot;bLK&quot;:false,&quot;lkObjName&quot;:null,&quot;knowledgeArticleTypeQueryFieldsMap&quot;:{},&quot;timeTracking&quot;:false,&quot;hideStepChart&quot;:false,&quot;mergeSavedData&quot;:false,&quot;visualforcePagesAvailableInPreview&quot;:{},&quot;cancelType&quot;:&quot;SObject&quot;,&quot;allowCancel&quot;:true,&quot;cancelSource&quot;:&quot;%ContextId%&quot;,&quot;cancelRedirectPageName&quot;:&quot;OmniScriptCancelled&quot;,&quot;cancelRedirectTemplateUrl&quot;:&quot;vlcCancelled.html&quot;,&quot;consoleTabLabel&quot;:&quot;New&quot;,&quot;wpm&quot;:false,&quot;ssm&quot;:false,&quot;message&quot;:{},&quot;pubsub&quot;:false,&quot;autoFocus&quot;:false,&quot;currencyCode&quot;:&quot;&quot;,&quot;showInputWidth&quot;:false,&quot;rtpSeed&quot;:false,&quot;consoleTabTitle&quot;:null,&quot;consoleTabIcon&quot;:&quot;custom:custom18&quot;,&quot;errorMessage&quot;:{&quot;custom&quot;:[]},&quot;stylesheet&quot;:{&quot;newport&quot;:&quot;&quot;,&quot;lightning&quot;:&quot;&quot;,&quot;newportRtl&quot;:&quot;&quot;,&quot;lightningRtl&quot;:&quot;&quot;},&quot;stepChartPlacement&quot;:&quot;right&quot;,&quot;disableUnloadWarn&quot;:true,&quot;scrollBehavior&quot;:&quot;auto&quot;,&quot;currentLanguage&quot;:&quot;en_US&quot;}</propertySetConfig>
<subType>Logging</subType>
<type>demo</type>
<uniqueName>demo_Logging_English_6</uniqueName>
<versionNumber>6.0</versionNumber>
<webComponentKey>533171c5-045f-0aab-f717-97eb6cd7e7f1</webComponentKey>
</OmniScript>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"orgName": "Nebula Logger - Build - Platform Cache Scratch Org",
"orgName": "Nebula Logger - Platform Cache Scratch Org",
"edition": "Enterprise",
"hasSampleData": true,
"country": "JP",
Expand All @@ -12,6 +12,9 @@
"communitiesSettings": {
"enableNetworksEnabled": false
},
"emailAdministrationSettings": {
"enableEnhancedEmailEnabled": false
},
"eventSettings": {
"enableDeleteMonitoringData": false,
"enableEventLogGeneration": false,
Expand Down
4 changes: 4 additions & 0 deletions docs/apex/Configuration/LoggerParameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ Controls if Nebula Logger queries `Schema.Network` data. When set to `false`, an

Controls if Nebula Logger queries `Schema.Network` data is queried synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `Schema.Network` fields on `LogEntryEvent__e` will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryNetworkDataSynchronously`, or `true` as the default

#### `QUERY_OMNI_PROCESS_DATA``Boolean`

Controls if Nebula Logger queries `Schema.OmniProcess` data. When set to `false`, any `Schema.OmniProcess` fields on `LogEntry__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryOmniProcessData`, or `true` as the default

#### `QUERY_ORGANIZATION_DATA``Boolean`

Controls if Nebula Logger queries `Schema.Organization` data. When set to `false`, any `Schema.Organization` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryOrganizationData`, or `true` as the default
Expand Down
Loading

0 comments on commit 1629291

Please sign in to comment.