-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null Record causes error #198
Comments
Actually, looking at it again, it doesn't matter whether Apex can tell the difference, does it? The field is required on the Flow side, so we can't save the action without specifying a record parameter. So Apex knows that a variable is there. If the variable is NULL, then it should just put an empty string (or NULL or whatever) in the record field. |
Hey again @vr8hub! That is actually related to some strange behavior in Flow itself - the Get Records action in Flow sends null as the parameter if no matching records are found. This is different behavior from how Apex works - in Apex, a query with no results returns an empty list (instead of null), so it's a slightly frustrating inconsistency in Flow vs Apex. But the good news is that it should be an easy fix - I'm going to make the Collection parameter optional for the action "Add Log Entry for SObject Collection", which will prevent this error from happening. I'll let you know as soon as I have this issue resolved, I should have a fix ready over the weekend or early next week. |
Awesome, thanks, Jonathan! (Same for the Record action, please.) |
Yeah, great point - I'll make the same change for the Record action as well. |
…wCollectionLogEntry (respectively) to handle situations where null is passed (e.g., Get Records returns null for no matches, instead of an empty list) (reported in #198)
…wCollectionLogEntry (respectively) to handle situations where null is passed (e.g., Get Records returns null for no matches, instead of an empty list) (reported in #198)
* Made record & records parameters optional in FlowRecordLogEntry & FlowCollectionLogEntry (respectively) to handle situations where null is passed (e.g., Get Records returns null for no matches, instead of an empty list) (reported in #198) * Changed FlowDescription__c.field to long text area + added automatic field-truncation for LogEntry__c inserts + added a ridiculously long description to one of the Flows in nebula-logger-recipes (reported in #199) * Made fancier buttons that include the release number * Cleaned up a few areas in README * Added 'Code Quality Tests' to deploy.yml + ran prettier * Setup ESLint for lwc + fixed some reported issues * Removed some unused scripts in package.json
* Added StripInaccessibleRecordFields__c setting * Added all CMDT objects to LoggerAdmin.permissionset * Added LogEntryDataMaskRule__mdt object for applying data mask rules to log entry message & record JSON fields in LogEntryEventBuilder * Added CMDT rules for credit card numbers & social security numbers * Added setting ApplyDataMaskRules__c to control if CMDT data mask rules are applied * Added some user managament settings to scratch-def files * Added test suites for each module * Moved some test helper methods to LoggerTestUtils, cleaned up LogEntryEventBuilder_Tests methods * Optimized setTagsDetails() * Made record & records parameters optional in FlowRecordLogEntry & FlowCollectionLogEntry (respectively) to handle situations where null is passed (e.g., Get Records returns null for no matches, instead of an empty list) (reported in #198) * Changed FlowDescription__c.field to long text area + added automatic field-truncation for LogEntry__c inserts + added a ridiculously long description to one of the Flows in nebula-logger-recipes (reported in #199) * Made fancier buttons that include the release number * Cleaned up a few areas in README * Added 'Code Quality Tests' to deploy.yml + ran prettier * Setup ESLint for lwc + fixed some reported issues * Removed some unused scripts in package.json * Switched back to using extra-tests folder, created LogEntryEventBuilder_IntegrationTests class (AccountBrand doesn't exist in all orgs) * Added new step to pipeline to create an unvalidated package version & auto-install it into the package-demo org, then reinstall the latest released package version * Reenabled Codecov.io integration in the pipeline * Added static code analysis / PMD through sfdx-scanner (#201 by @jamessimone) * Fixed line breaks not working when calling System.debug() @jamessimone and I had a lot of... "fun" with this one Co-authored-by: James Simone <[email protected]>
After getting everything setup (thanks again!), I quickly ran into my first challenge. I have a Get Records, and immediately after it, I put a Add Log SObject action to log the results. But, the flow died with the action complaining it didn't get a required parameter: records.
Except I did specify the parameter, it's just the results of the Get Records was nothing found, so the variable itself was empty, which is precisely what I wanted to log.
The absence of a parameter vs. the parameter being present and empty are two different things. Maybe Apex can't tell the difference in this circumstance(?), but if it can, it would be preferable if the action just logged the fact that the record was empty. I know I can put log actions on both sides of a test following the Get Records, but it would be better (cleaner) if that wasn't necessary.
Thanks!
The text was updated successfully, but these errors were encountered: