Skip to main content

Notifications

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

move the new document field to the archive after posting

Posted on by 41

Hi Community,

I have created new text field in Sales Line Table, i exposed it on page, and that works fine. Now i want to insert that field with same value (not editable) into Sales Line Archive Table, and expose it on archive page. What is best practice do do it? I tried with LOOKUP but when document is posted, is automaticaly moved toSales Line Archive, and deleted from Sales Line Lookup field doesnt work. In this case should work something like INSERT, can i do it from Object designer level?

  • Suggested answer
    Kamill11 Profile Picture
    Kamill11 41 on at
    RE: move the new document field to the archive after posting

    I was trying to keep ID convention and two fields had different ID, after set same ID's works. Thank you.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: move the new document field to the archive after posting

    Please create those sales line field exactly same in your Archive table and post the entries with Archive method, you will see that you data is transferred without any code.

    Thanks.

  • Verified answer
    DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: move the new document field to the archive after posting

    hi

    simply assign the custom field you create on the archive the same ID as the one created in the sales line

    check my answer if it helped you, thanks

    DANiele

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,472 Super User 2024 Season 2 on at
    RE: move the new document field to the archive after posting

    Hi, I checked the standard codes for BC (NAV2016 may be the same), For Line, the standard uses the TransferFields method, so as long as your ID, field type, and length are the same, the value should be automatically transferred to the Sales Line Archive Table.

    More details:

    Record.TransferFields(var Record [, Boolean]) Method: Copies all matching fields in one record to another record.

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-transferfields-table-boolean-method

    pastedimage1671060398954v1.png

    Hope this helps.

    Thanks.

    ZHU

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!

Community AMA December 12th

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans