Type.OpenRecord
TypeReturns an open version of a record type, allowing values to have additional fields beyond those declared.
Syntax
Type.OpenRecord(type as type) as typeParameters
| Name | Type | Required | Description |
|---|---|---|---|
type | type | Yes | A record type to open. Must be a record type. |
Return Value
type — An open record type derived from the given record type.
Remarks
Type.OpenRecord converts a closed record type into an open record type, allowing values typed with it to have additional fields beyond those explicitly declared. If the input type is already open, it is returned unchanged. The complement function is Type.ClosedRecord.
In Power Query M's type system, the distinction between open and closed record types matters when annotating values with Value.ReplaceType or building custom connector schemas. An open record type signals that a value may carry extra fields — this is the default behavior of most records in M since the base type record is open. A closed type enforces that only the declared fields exist.
A common use case for Type.OpenRecord is to loosen a previously closed schema. For example, if a custom connector returns a typed record with a closed schema but you want to allow downstream steps to add fields without type errors, you can open the type before applying it.
Use Type.IsOpenRecord to test the current state, and Type.ClosedRecord to restrict a type back to closed.
Examples
Example 1: Open a closed record type and verify
let
Closed = Type.ClosedRecord(type record),
Opened = Type.OpenRecord(Closed)
in
Type.IsOpenRecord(Opened)The final output — converts the closed record type back to open using Type.OpenRecord, then checks Type.IsOpenRecord to confirm it is open.
Result | |
|---|---|
| 1 | TRUE |
Example 2: Open a typed record type built with Type.ForRecord
let
Closed = Type.ForRecord([Name = [Type = type text, Optional = false]], false),
Opened = Type.OpenRecord(Closed)
in
Type.IsOpenRecord(Opened)The final output — converts the closed typed record type to open using Type.OpenRecord, then checks Type.IsOpenRecord to confirm it is open.
Result | |
|---|---|
| 1 | TRUE |
Example 3: Opening an already-open type returns it unchanged
let
AlreadyOpen = type record,
StillOpen = Type.OpenRecord(AlreadyOpen)
in
Type.IsOpenRecord(StillOpen)The final output — calls Type.OpenRecord on the already-open type, then checks Type.IsOpenRecord to confirm it is still open (the function is idempotent).
Result | |
|---|---|
| 1 | TRUE |