Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

relationships fields between tables in business central

Posted on by 465

Hi community,

Could you help me, how I can populated 1 : N Relationships?

For example I have a field in sales quote (Quote name), and I want after created the order populate the same data in sales order field (Order name)

pastedimage1670348193758v1.png

Thanks

Categories:
  • Suggested answer
    pankaj.k Profile Picture
    pankaj.k 962 on at
    RE: relationships fields between tables in business central

    Hi Manuel Lozada,

    if you want to Transfer your New Field Data form "Sales Quote" to "Sales Order" then you need to Write Code on  (EventSubscriber  OnAfterInsertSalesOrderHeader). Use below code...

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Quote to Order", 'OnAfterInsertSalesOrderHeader', '', false, false)]
    local procedure OnAfterInsertSalesOrderHeader(var SalesOrderHeader: Record "Sales Header"; SalesQuoteHeader: Record "Sales Header");
    begin

        SalesOrderHeader.YourField := SalesQuoteHeader.YourField;
        salesorderheader.Modify();
    end; 


    6685.Capture.PNG
    Thanks 
  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,217 Moderator on at
    RE: relationships fields between tables in business central

    Hi

    you should ask your partner to develop a customisation.
    the part involved is this:

    codeunit 86 "Sales-Quote to Order" - > local procedure CreateSalesHeader -> OnBeforeModifySalesOrderHeader
    pastedimage1670428863948v1.png

    you should latch on to this event

    DAniele

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 70,124 Super User 2024 Season 2 on at
    RE: relationships fields between tables in business central

    Hi, If you want to transfer the data on Sales Quote to Sales Order when creating Order. Please refer to Amit's suggestion. You need to add the code when creating the order.

    If you just associate some data, such as master data. Consider using TableRelationship or Flowfield.

    Hope the following helps.

    https://yzhums.com/22220/

    And

    FlowFields (Sum, Average, Exist, Count, Min, Max, Lookup)

    https://yzhums.com/5802/

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

    https://yzhums.com/5985/

    How to enter any value in a TableRelation field (Without validating the table relationship)

    https://yzhums.com/17582/

    Thanks.

    ZHU

  • Suggested answer
    Amit_Sharma Profile Picture
    Amit_Sharma 2,545 on at
    RE: relationships fields between tables in business central

    Hi,

    use this event for achieving the functionality.

    OnBeforeInsertSalesOrderHeader(SalesOrderHeader, SalesHeader);
    and for use of Eventscriber. Refer the below link
    Regards
    Amit Sharma

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,564 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,651 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans