jongpie / NebulaLogger

The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.
MIT License
644 stars 153 forks source link

Add the ability to log Flow callout requests and responses #634

Open jongpie opened 4 months ago

jongpie commented 4 months ago

Flows has the ability to make HTTP callouts with External Services, similar to the Apex classes HttpRequest, HttpResponse, and Http that can be used to make callouts.

Ideally, Nebula Logger should provide a way to log the Flow callout request and response, similar to the Apex instance methods LogEntryEventBuilder.setHttpRequestDetails() and LogEntryEventBuilder.setHttpResponseDetails() (see discussion #632). However, I haven't use this functionality in Flow, so I'm not sure how exactly this works in Flow, nor what the data types are of the Flow callout request & response. It might "just work", but it might require some changes to Nebula Logger's 3 invocable logging classes - FlowLogEntry, FlowLogRecordEntry, and FlowCollectionLogEntry - to support this.

JMercie commented 2 months ago

Hi @jongpie !

I was reviewing this issue and setup a sample with the pokeapi just to test what we get as I haven't use Flows for callouts before.

Looks like we get access to a resource with three properties:

I don't think any change is required, maybe support Apex-defined collections in case you want to log response body entirely, as we currently support only a string as the "message"

jongpie commented 2 months ago

@JMercie that's incredibly helpful, thanks so much for testing this out. I like the idea of maybe supporting Apex-defined object/collections, or simply some additional String properties on the current Flow actions - but I think let's hold off on this for now.

My thought is that at the moment, Nebula Logger's Flow actions already have several properties on them, so it's already a lot of fields for admins to fill out when configuring the invocable action. Before adding even more properties (to support storing Flow callout data), I want to first explore creating a custom property editor (CPE) LWC for the Flow actions to see if that would provide a better user experience for admins configuring the Flow actions. After that, then I'd like to revisit this issue to see if it does make sense to add some way to store the Flow callout data.