-
I have installed NebulaLogger with the intent to use it with OmniStudio. I would like to pass the JSON of the Step to the Log as a new entry. I assume you would pass it as an argument in the newEntry() method, but so far I have not gotten that part working. If the OmniScript has a step named Step1, how would I pass the JSON for Step 1 to the log through the new entry method? Even better would be to send the full JSON as my scripts are a series of child scripts with some JSON being passed from one to the other in addition to the step data on each script. I know the OmniStudio part of NebulaLogger is new but I would appreciate any help you might have |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Hi @aBerean2 any chance you could provide some screenshots/examples of the JSON that you're referring to? There's definitely a chance that I might need to add an extra argument, but I'll need to test out what you're referring to in a scratch org to see. |
Beta Was this translation helpful? Give feedback.
-
Thanks for taking a look.
As a proof of Concept I created an OmniScript with two “steps,” Step1 and Step2, With each having two Text fields, Text1, Text2, Text3, and Text4.
When I run the script in preview mode it produces the following JSON:
{
"timeStamp":"2024-10-22T20:32:52.303Z",
"userProfile":"System Administrator",
"userTimeZoneName":"America/Chicago",
"userTimeZone":"-300",
"userCurrencyCode":"USD",
***@***.******@***.***>,
"userId":"005f2000008cC7bAAE",
"omniProcessId":"0jNUQ0000000FNF2A2",
"localTimeZoneName":"America/Chicago",
"Step1":{
"Text1":"Value1",
"Text2":"Value2"
},
"isSuccess":true,
"Step2":{
"Text3":"Value 3",
"Text4":"Value 4"}
}
In between the Steps and after the steps I created a RemoteAction as described in Wiki with the following in the extrapayload section which corresponds to the parameters for the CallableLogger class:
"extraPayload": {
"loggingLevel": "FINEST",
"message": "Intermediate",
"saveLog": true
},
When it successfully creates the Log and the log entry it does any excellent job but it does not pass the JSON value from the Script to the Log.
I started looking at passing the JSON through the message parameter but that seems to be limited to a static string value. My last attempt was to put one of the values for the OmniScript metadate into the message parameter but just sent the actual string text.
In the WIKI for the newEntry Method you have these paramaetrs that might be able to do what I have in mind but not sure how that would work:
recordId
Optional
Id
When provided, Nebula Logger automatically ties the log entry to the specified SObject record ID.
Cannot be used at the same time as record, recordList, or recordMap
record
Optional
SObject
When provided, Nebula Logger automatically ties the log entry to the specified SObject record, and stores a JSON copy of the provided SObject record.
Cannot be used at the same time as recordId, recordList, or recordMap
recordList
Optional
List
When provided, Nebula Logger automatically stores a JSON copy of the provided list of SObject records.
Cannot be used at the same time as recordId, record, or recordMap
recordMap
Optional
Map
When provided, Nebula Logger automatically stores a JSON copy of the provided map of SObject records.
Cannot be used at the same time as recordId, record, or recordList
Ken Banks
Maranatha Baptist University
Director of Information Technology -- IT
o. 2421 745 West Main Street
c. 206-641-5768 Watertown, WI 53094
mbu.edu<http://mbu.edu/> ***@***.******@***.***>
From: Jonathan Gillespie ***@***.***>
Sent: Tuesday, October 22, 2024 2:52 PM
To: jongpie/NebulaLogger ***@***.***>
Cc: Ken Banks ***@***.***>; Mention ***@***.***>
Subject: Re: [jongpie/NebulaLogger] Using NebulaLogger with OmniStudio -- passing the script JSON to the Log? (Discussion #785)
Hi @aBerean2<https://github.com/aBerean2> any chance you could provide some screenshots/examples of the JSON that you're referring to? There's definitely a chance that I might need to add an extra argument, but I'll need to test out what you're referring to in a scratch org to see.
—
Reply to this email directly, view it on GitHub<#785 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BMK2IHABOFR5QA36EY2EKM3Z42UE5AVCNFSM6AAAAABQNGVEEKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMBSGE2DGMQ>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
-
Yes, this would be an excellent option.
How would I go about making the change to the apex class. When I go into the class there is no edit button.
While I am the primary admin in many ways I am new to SalesForce, my expertise being SQL admin and SQL development.
Ken Banks
Maranatha Baptist University
Director of Information Technology -- IT
o. 2421 745 West Main Street
c. 206-641-5768 Watertown, WI 53094
mbu.edu<http://mbu.edu/> ***@***.******@***.***>
From: Jonathan Gillespie ***@***.***>
Sent: Wednesday, October 23, 2024 11:23 AM
To: jongpie/NebulaLogger ***@***.***>
Cc: Ken Banks ***@***.***>; Mention ***@***.***>
Subject: Re: [jongpie/NebulaLogger] Using NebulaLogger with OmniStudio -- passing the script JSON to the Log? (Discussion #785)
@aBerean2<https://github.com/aBerean2> thanks for the extra context! I'm still learning OmniStudio myself, so the additional info is very helpful. I was able to setup a similar OmniScript in a scratch org & I see what you're referring to, and I think I can automatically capture that JSON any time you use the newEntry() method (you won't need to pass it as a parameter).
For example, I made a small OmniScript with 2 steps (each with a few inputs), and added some logging after each step. For each logging action, I'm still only providing the same 3 parameters that you're using: loggingLevel, message, and saveLog.
image.png (view on web)<https://github.com/user-attachments/assets/fd02be35-b6b4-4aea-a104-549fe73131e9>
With a couple of tweaks to the CallableLogger class, I was able to make it automatically get the JSON from each of the steps & append it to the contents of the field LogEntry__c.Message__c. Long-term, I might make a new field to store this data, but for now, appending it to the Message__c field is a quick & easy way to capture the JSON.
image.png (view on web)<https://github.com/user-attachments/assets/8085ae7c-102b-44f4-b777-4aaa6d44f0f0>
Let me know what you think of this approach - if you think this seems like a reasonable solution, I can probably get this wrapped up & released in the next few days.
—
Reply to this email directly, view it on GitHub<#785 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BMK2IHCTPTFK2GF23USXX4TZ47EPZAVCNFSM6AAAAABQNGVEEKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMBTGE3DKMQ>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the update. I read your previous answer a little close and saw it would depend upon you putting out a new version of the tool, and with it the class.
I am very impressed with all of your efforts in building an extraordinary tool for all of us to use.
Enevn without the JSON it has been vey useful. With the JSON it will be invaluable in building OmnIScripts to fix intermittent issues like the one I have where some contacts that are supposed to save are failing but so far I have never been able to replicate the problem.
Ken Banks
Maranatha Baptist University
Director of Information Technology -- IT
o. 2421 745 West Main Street
c. 206-641-5768 Watertown, WI 53094
mbu.edu<http://mbu.edu/> ***@***.******@***.***>
From: Jonathan Gillespie ***@***.***>
Sent: Wednesday, October 23, 2024 1:50 PM
To: jongpie/NebulaLogger ***@***.***>
Cc: Ken Banks ***@***.***>; Mention ***@***.***>
Subject: Re: [jongpie/NebulaLogger] Using NebulaLogger with OmniStudio -- passing the script JSON to the Log? (Discussion #785)
@aBerean2<https://github.com/aBerean2> thanks for the feedback! In that case, I'll work on getting this change finished up (there's just some code cleanup & testing I need to finish) - I've created issue #788<#788> to officially track this as an enhancement, and hope to finish it soon.
As far as updating the Apex class in your own Salesforce org, are you looking in your production org/environment? Or are you in a sandbox/scratch org? If you're looking in your production org, then it won't show an Edit button because Apex code can't be modified directly in production - but ultimately, if you're using Nebula Logger's unlocked package, then you won't need to modify the Apex class yourself, you'll be able to upgrade your version (once I have the change ready).
* You can check to see if you're using Nebula Logger's package by checking under Setup --> Installed Packages. If you see 'Nebula Logger' listed on this page, then you're using the package. If this is the case, then once I have a new version ready, there will be a new package you'll be able to install, and the installation process will handle updating the Apex class for you.
—
Reply to this email directly, view it on GitHub<#785 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BMK2IHEIDXVSVF355AQYZVTZ47VWNAVCNFSM6AAAAABQNGVEEKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMBTGI4TONA>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Beta Was this translation helpful? Give feedback.
@aBerean2 thanks for the feedback, and really glad to hear that it's been helpful to have logging in OmniStudio 🥳
I've just published release
v4.14.16
, which provides the enhancement to automatically capture the JSON from each step. Whenever you have a chance to upgrade & try it out, let me know if you have any other feedback. Thanks again!