web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

How to safely transfer custom fields from Sales Header to Sales Invoice Header during Posting in BC

(2) ShareShare
ReportReport
Posted on by 306

Hi

Question:

I added a custom field Agreement No. to both tables:

  • Sales Header
  • Sales Invoice Header

Both fields have the same Field ID:

field(52160; "Agreement No."; Code[20])

Example:

Before Posting:

Sales Header
Agreement No. = 1

After Posting:

Sales Invoice Header
Agreement No. = ?

My questions:

  1. Does Business Central automatically transfer the value because both fields have the same Field ID and name?
  2. If not, what is the recommended and safest AL approach to transfer custom fields from Sales Header to Sales Invoice Header during posting?

Which Event Subscriber or standard Microsoft pattern should be used?

  1. After posting, if I need to update the value of:
Sales Invoice Header."Agreement No."

is it allowed to modify posted documents?

If yes, what is the correct and recommended way to update a custom field in Sales Invoice Header safely without affecting the standard posting process?

Thank you.

  • Verified answer
    Tony NAVCore Development Profile Picture
    59 on at

    You are correct that BC will automatically transfer the value because the Field ID is the same.  However, it doesn't matter the name.  This means you can't have 2 fields with 2 different names sharing the same Field ID either.  The value in the Sales Header will carry over to the Sales Invoice Header regardless.  If the fields have different types, you may get an error.

     

    You may want to consider the Sales Cr.Memo Header as well as the Sales Shipment Header.

     

    Don't forget the Sales Header Archive if you enable archiving.

     

    The nice thing about BC is that you don't even need to explicitly implement the transfer code. The standard code is already doing this, so all you need is to introduce the custom field with the same Field ID in the posted side.  Whatever you put into the Sales Header table will automatically transfer to the posted tables without additional coding.

  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,481 User Group Leader on at

    Hi @Rami Mazrawi  * ,

    The custom fields values transfer from Sales Header to Sales Invoice Header, Sales Shipment Header, Sales Cr. Memo Header & Return Receipt Header using TRANSFERFIELDS

    TransferFields works on logic: The field should have same Id, Datatype and Length (if applicable) in all tables listed above. 

    ** With Business Central, I feel subscribing event rather than relying on Transfer fields. Not a common practice but make sense to understand field usages in future.

    For older document you can update custom fields in Sales invoice header table, without any issues or via rapidstart package if you have lot of records.

    Regards,

    Saurav Dhyani

    YouTube: saurav dhyani - YouTube

    LinkedIn: Saurav Dhyani | LinkedIn

    Blog: Saurav Dhyani - #MSDynNAV & #MSDyn365bc

  • Verified answer
    YUN ZHU Profile Picture
    103,702 Super User 2026 Season 2 on at

    Hi, hope the following helps as well.

    Dynamics 365 Business Central: How to flow/pass custom field values

    https://yzhums.com/4118/

     

    Thanks.

    ZHU

  • Suggested answer
    Grigorios Mavrogeorgis Profile Picture
    3,666 Super User 2026 Season 2 on at

    Hi Rami, yes, it goes over by itself. Posting uses TransferFields from Sales Header to Sales Invoice Header, and that works by field ID, not by name. Same ID and same type, no subscriber needed. Just don't make the posted field shorter than the source.

    Do the same on Sales Shipment Header, Sales Cr.Memo Header, Return Receipt Header and the archive, otherwise the value is on the invoice and missing on the shipment.

    After posting, yes, a custom field can be changed, it doesn't touch the ledger. The Microsoft pattern is the Update Document action on the posted invoice. Extend that page, and subscribe to the event in the codeunit behind it, Sales Inv. Header - Edit if memory serves. The codeunit needs Permissions for tabledata Sales Invoice Header = rm, otherwise normal users get a permission error.

    Glad to help - follow up if anything is unclear.   

    ►  If this solved it, marking it verified helps others too.       

    Regards,
    Grigorios Mavrogeorgis
    Business Central Consultant & AL Developer

    Work: Gmsoft Limited
    Blog:  insidebusinesscentral
    LinkedIn: linkedin.com/in/gregorymavrogeorgis

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 765 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 571 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 299 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans