microsoft / microsoft/AL

Variant can't contain a Records Company information

Open
#7,933 3 comments 1 reaction 1 assignee View on GitHub

@BazookaMusic is already working on this.

Since Jan 28, 2025.

investigate
Dominant language
PowerShell
Stars
881
Forks
285
Avg merge
3d 36m
Merged PRs (30d)
1

Description

Got issues with recordref with other companies in BC together with variants. How can I get this fixed ?

Working with a lot of RecordRef's and variants. Found out today that RecordRef do have CurrentCompany, but it doesn't work if the assignment to RecordRef comes from an variant and not the record itself.

Example code;

trigger OnOpenPage()

var

    customer: Record Customer;

    recordref: RecordRef;

    variant: Variant;

begin

    customer.ChangeCompany('OTHER COMP');

    recordref.GetTable(customer);

    Message(recordref.CurrentCompany);

 

    clear(recordref);

    variant := customer;

    recordref.GetTable(variant);

    Message(recordref.CurrentCompany);

end;

First message is correct company (OTHER COMP). second message will be current company and not OTHER COMP.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.