web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Add company lookup to Report request page

(0) ShareShare
ReportReport
Posted on by 627

Hello

I am new to BC and I have to create a Report extension (Copy fixed asset) and add a company lookup to the Report Request Page to use the Selection for the copy later

How can I do this?

Best regards

Chris

I have the same question (0)
  • CU11121527-0 Profile Picture
    4 on at

    Hello,

    Not sure I understand what you are trying to do? If you are simply looking for a list of companies you could try the following tables via API

    table 2000000006 = Company (holds list of companies) you may not have access to this table

    table 79 = Company Information (holds details about a specific company)

    See this article for more details link

  • Suggested answer
    YUN ZHU Profile Picture
    102,123 Super User 2026 Season 1 on at

    Hi, It seems that you need a lookup to the company field, I hope the following information can give you some hints.

    How to create a Lookup, Drop-Down, or Option list (Single and Multi select)

    https://yzhums.com/5985/

    Thanks.

    ZHU

  • CRSW Profile Picture
    627 on at

    thx for the answer. I did it exactly like described inside a fielddefinition named CompanyName but I get the message: The left-hand side of an assignment must be a variable or field

    Here the code:

                   field(CompanyName; CompanyName)

                   {

                       Caption = 'Company Name';

                       ApplicationArea = FixedAssets;

                       Lookup = true;

                       ;

                       TableRelation = "Company Information";

                       trigger OnLookup(var Text: Text): Boolean

                       var

                           CompanyRec: Record "Company Information";

                       begin

                           CompanyRec.Reset();

                           if Page.RunModal(Page::"Company Information", CompanyRec) = Action::LookupOK then

                              CompanyName := CompanyRec.Name;

                       end;

                   }

  • Suggested answer
    Mohana Yadav Profile Picture
    61,223 Super User 2026 Season 1 on at

    CompanyName is system defined function so we should not use that.

    Declare a variable with name CompName etc. and use it instead of CompanyName.

  • Suggested answer
    Mohana Yadav Profile Picture
    61,223 Super User 2026 Season 1 on at

    This code should be enough

    field(CompName; CompName)

               {

                   Caption = 'Company Name';

                   ApplicationArea = FixedAssets;

                   TableRelation = Company;

               }

    var

           CompName: Code[30];

  • CRSW Profile Picture
    627 on at

    Nothing seems to work. All options mentioned here are ending in errors....(different kind of)

  • Suggested answer
    Mohana Yadav Profile Picture
    61,223 Super User 2026 Season 1 on at

    Could you please share the code and error?

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Please share your complete code here

  • CRSW Profile Picture
    627 on at

    Here the code (but I played around allready:

    reportextension 62005 "CopyFixedAssetCFAC" extends "Copy Fixed Asset" //5685
    {
        dataset
        {
        }
        requestpage
        {
            layout
            {
                addbefore(FANo)
                {
                    /*
                    field(CompName; CompName)
                    {
                        Caption = 'Company Name';
                        ApplicationArea = FixedAssets;
                        TableRelation = "Company Information";
                    }
                       
                    trigger OnLookup(var Text: Text): Boolean
                    var
                        CompanyRec: Record "Company Information";
                    begin
                        CompanyRec.Reset();
                        if Page.RunModal(Page::"Company Information", CompanyRec) = Action::LookupOK then
                            CName := CompanyRec.Name;
                    end;
            */
                    field(CompName; CompName)
                    {
                        Caption = 'Company Name';
                        ApplicationArea = FixedAssets;
                        TableRelation = Company;
                    }
                    var
                       CompName: Code[100];
                }
            }
        }
    }
  • Verified answer
    Mohana Yadav Profile Picture
    61,223 Super User 2026 Season 1 on at

    Try with this. Looks like you are new to BC coding and need to learn where to place the code/variable declaration etc.

    reportextension 62005 "CopyFixedAssetCFAC" extends "Copy Fixed Asset" //5685

    {

       dataset

       {

       }

       requestpage

       {

           layout

           {

               addbefore(FANo)

               {

                   /*

                   field(CompName; CompName)

                   {

                       Caption = 'Company Name';

                       ApplicationArea = FixedAssets;

                       TableRelation = "Company Information";

                   }

                   trigger OnLookup(var Text: Text): Boolean

                   var

                       CompanyRec: Record "Company Information";

                   begin

                       CompanyRec.Reset();

                       if Page.RunModal(Page::"Company Information", CompanyRec) = Action::LookupOK then

                           CName := CompanyRec.Name;

                   end;

           */

                   field(CompName; CompName)

                   {

                       Caption = 'Company Name';

                       ApplicationArea = FixedAssets;

                       TableRelation = Company;

                   }

               }

           }

       }

       var

           CompName: Code[100];

    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,496 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 961 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 870 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans