web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 625

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
    RE: Add company lookup to Report request page

    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
    93,024 Super User 2025 Season 2 on at
    RE: Add company lookup to Report request page

    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
    625 on at
    RE: Add company lookup to Report request page

    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
    60,969 Super User 2025 Season 2 on at
    RE: Add company lookup to Report request page

    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
    60,969 Super User 2025 Season 2 on at
    RE: Add company lookup to Report request page

    This code should be enough

    field(CompName; CompName)

               {

                   Caption = 'Company Name';

                   ApplicationArea = FixedAssets;

                   TableRelation = Company;

               }

    var

           CompName: Code[30];

  • CRSW Profile Picture
    625 on at
    RE: Add company lookup to Report request page

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

  • Suggested answer
    Mohana Yadav Profile Picture
    60,969 Super User 2025 Season 2 on at
    RE: Add company lookup to Report request page

    Could you please share the code and error?

  • Suggested answer
    Nitin Verma Profile Picture
    21,692 Moderator on at
    RE: Add company lookup to Report request page

    Please share your complete code here

  • CRSW Profile Picture
    625 on at
    RE: Add company lookup to Report request page

    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
    60,969 Super User 2025 Season 2 on at
    RE: Add company lookup to Report request page

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,808

#2
Sumit Singh Profile Picture

Sumit Singh 2,554

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,140

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans