Power Query M code
let
Source = YourRecord,
SafeValue = Record.FieldOrDefault(Source, "FieldName", null)
in
SafeValue
Returns a default value instead of an error when an expected record field doesn't exist.
let
Source = YourRecord,
SafeValue = Record.FieldOrDefault(Source, "FieldName", null)
in
SafeValue
Useful when working with JSON responses where a field may sometimes be missing.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Safely Access a Record Value.