Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Add company lookup to Report request page

Posted on by 593

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

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

    Yes I will. It is just playing around. writing a new report and do such stuff seems to be easy (more or less) but extending one and do the coding to change the functionality of the existing one is not that clear to me

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,125 Super User 2024 Season 2 on at
    RE: Add company lookup to Report request page

    Give it a try.

    https://yzhums.com/6362/

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

    Hi

    Yes as I told in the first message I am new to BC. Thx. a lot. the lookup works.

    Now I have to find out how I can extend the rest to copy the FA from the selected company to the current one.

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,125 Super User 2024 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];

    }

  • CRSW Profile Picture
    CRSW 593 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];
                }
            }
        }
    }
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Add company lookup to Report request page

    Please share your complete code here

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,125 Super User 2024 Season 2 on at
    RE: Add company lookup to Report request page

    Could you please share the code and error?

  • CRSW Profile Picture
    CRSW 593 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
    Mohana Yadav 59,125 Super User 2024 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];

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,125 Super User 2024 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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans