Skip to main content

Notifications

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

How to Auto-populate data On a field

(1) ShareShare
ReportReport
Posted on by 105

Hi all,

I have created a new field called Unit Price in the Transfer Line table and then I added that field in the Transfer Order subform as well. Now when I create a Transfer order and select Item no I want also the Unit price(In my Transfer Line) of that Item to populate directly from the Item card(Take the value which is in the Item card unit price). The same way description and unit of measure populate.

Thank you for your constant assistance.

  • Maro9595 Profile Picture
    Maro9595 105 on at
    RE: How to Auto-populate data On a field

    that's supper ZHU

    thank you so much

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 74,036 Super User 2024 Season 2 on at
    RE: How to Auto-populate data On a field

    Hi, try the following.

    tableextension 80122 MyExtension extends "Transfer Line"
    {
        fields
        {
            modify("Item No.")
            {
                trigger OnAfterValidate()
                var
                    Item: Record Item;
                begin
                    if Item.Get("Item No.") then
                        "Unit Price" := Item."Unit Price";
                end;
            }
            field(50100; "Unit Price"; Decimal)
            {
                DataClassification = CustomerContent;
            }
        }
    }
    
    pageextension 80122 MyExtension extends "Transfer Order Subform"
    {
        layout
        {
            addafter(Quantity)
            {
                field("Unit Price"; Rec."Unit Price")
                {
                    ApplicationArea = All;
                }
            }
        }
    }

    pastedimage1642984435578v1.png

    Hope this will help.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: How to Auto-populate data On a field

    Just so you are aware. When you do a transfer the unit cost that is posted will be determined by the costing method on your items. But your added field might fill another purpose. Anyway i just wanted to let you know.

  • Maro9595 Profile Picture
    Maro9595 105 on at
    RE: How to Auto-populate data On a field

    Thank you Josh,

    Can you please guide me on how to accomplish this you have mentioned new another object "Event subscriber"

  • Suggested answer
    JAngle Profile Picture
    JAngle 33,159 on at
    RE: How to Auto-populate data On a field

    Create an event subscriber to the transfer line table OnAfterInsert. Use the .GET() to fill a var of the item table and then pass the required value to your field and modify()

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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans