Skip to main content

Notifications

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

Display Vendor Name when I choose the vendor ID

Posted on by 35

Hi everyone,

I need to fill the Name field when I select a vendor ID

How I can do it

pastedimage1681399239996v2.png

thanks

  • Verified answer
    Deekshitha Reddy Profile Picture
    Deekshitha Reddy 219 on at
    RE: Display Vendor Name when I choose the vendor ID

    I have used 2 tables here, So in the second table's card were I wanted to display name when id is entered. Write the code on trigger ONVALIDATE of id field. 

    field(1; studentid; Code[50])//Second Table 
            {
                DataClassification = ToBeClassified;
                trigger OnValidate()
                var
                    s1: Record Studenttable//variable of type record, from first table from where I am getting name(details) 
                begin
                    IF s1.Get(studentid) then
                        student_name := s1.studentname;
                end;
    field(2; student_name; Code[50])
            {
                DataClassification = ToBeClassified;
            }
    }
    Hope this helps.
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 73,565 Super User 2024 Season 2 on at
    RE: Display Vendor Name when I choose the vendor ID

    Hi, I have mentioned several simple solutions in the following post, hoping to give you some hints.

    https://yzhums.com/22220/

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Display Vendor Name when I choose the vendor ID

    Is your page based on the standard vendor table or have you created your own table.

    If you have created your own table you can add a flow field to your table with the type LookUp.

    That will display the vendor name in the table even if it is not stored in your table.

    learn.microsoft.com/.../devenv-flowfields

  • Verified answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: Display Vendor Name when I choose the vendor ID

    Hi company1,

    You have two options to achieve this. You can either add your logic to the OnValidate() trigger of VendorID field on the page level, or you can create a method in your table which gets the vendor name using the vendor ID, here is the code for the method

        procedure displayVendorName(): Text
        var
            vendTable: Record Vendor;
        begin
            if vendTable.Get(Rec.VendorID) then begin
                exit(vendTable.Name);
            end;
        end;

    Then, you use the displayVendorName() method in the page field as follows

                    field(VendorID; Rec.VendorID)
                    {
                        ApplicationArea = All;
                    }
                    field(PartcipantName; Rec.displayVendorName())
                    {
                        ApplicationArea = All;
                    }

    I hope this helps, let me know if you have any queries.

    Regards

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,137 Super User 2024 Season 2 on at
    RE: Display Vendor Name when I choose the vendor ID

    You can make the Name field as flowfield to show the name based on the Vendor No.

    Or you can write code in OnValidate trigger of Vendor No. field to get the vendor record and assign Name

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans