FlowLogEntry throws exception for empty recordId
Package Edition of Nebula Logger
Unlocked Package
Package Version of Nebula Logger
v4.15.3
New Bug Summary
I'm using a subflow as a fault path for elements, one of the subflow's variables is recordId which is set as input. In subflow, I have Flow Log Entry action and I've set recordId to be assigned from my input variable to action.
When recordId is null/empty my flow catches exception:
An Apex error occurred: System.StringException: Invalid id:
I could make a workaround for this by checking if recordId is provided and only then use it in the action, but this makes it more complicated. Would it be possible to make Apex Action to ignore null/empty recordId?
The same issue is being encountered when we do setRecordId in apex and value is null. This causes issues while chaining LogEntryEventBuilder using dot operator.
@dominykasvitkus I think that issue has come up a few times before, and seems to be a limitation on the Flow side / I'm not sure if there's much that can be done on my side to handle it. But I'll look into it again to see if there's any kind of workaround that I can incorporate.
@fullstackpiyush I can't reproduce that issue - the Apex script below works for me. Can you provide more details about your code & what version of Nebula Logger you're using?
Id nullId;
Exception someEx = new System.DmlException('whoops');
Logger.info('test').setRecordId(nullId).setExceptionDetails(someEx);
@jongpie not sure if it's possible, but converting empty input to null in InvocableMethod should help imo @fullstackpiyush most likely your value is not null, but empty, try making some checks on that
In Winter 26, this should be resolved in Flows that run with version 65.0+
Evaluate Null ID Values for Apex Invocable Actions
Configure an Apex action input that’s an ID data type with a value that is null at run time without causing the flow to fail. Previously, null values were considered invalid. In Flow Builder, Apex inputs of ID data type continue to show as text inputs and treat empty strings as invalid.
I'd love to hear if this change actually resolves this issue, let me know!