Missing compiler error when assigning a Variant to a RecordRef
@esbenk is already working on this.
Since May 8, 2026.
- Dominant language
- PowerShell
- Stars
- 881
- Forks
- 285
- Avg merge
- 3d 36m
- Merged PRs (30d)
- 1
Description
1. Describe the bug
Since BC 26 / runtime 15.2, an implicit conversion between Record and RecordRef is supported.
The compiler now allows us also to assign a (record based) variant to RecRef:
RecRef := SomeVariant;
But this will result in a runtime error:
The expression Microsoft.Dynamics.Nav.Runtime.NavIndirectValue cannot be type-converted to a Microsoft.Dynamics.Nav.Runtime.NavRecordRef value.
2. To Reproduce
Steps to reproduce the behavior:
Add assignment like RecRef := SomeVariant;.
Then run the code in the web client.
3. Expected behavior
Error in the AL compiler for the RecRef := SomeVariant; line, no publish possible.
4. Actual behavior
Error in the web client, which is too late.
5. Versions:
- AL Language: v17.0.2273547
- Business Central: 27.1
Internal work item: AB#634365
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.