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...
Unanswered

Copy Custom Field while Posting Sales Invoice

(0) ShareShare
ReportReport
Posted on by 4,042
I have a custom field let's say "Package Number" in Sales Header table and also in the "Sales Invoice Header" table. I want the field value to be automatically transferred from "Sales Header" to "Sales Invoice Header" during Posting of Invoice. 
Following method works, but I had to add RIMD permission to avoid permission error. My concern is does this mean all users will have RIMD permission? If the user's Permission Sets does not allow "Insert" on Sales Invoice Header, I don't want that person to be able to Post.
 
I also noticed that removing "Modify();" and "Permissions = RIMD" also saves the fields correctly during Posting. but I am not sure if it will be reliable without "Modify();"
 
In any case, please advise what is the best way to achieve this. Thank you

    Permissions = tabledata "Sales Invoice Header" = RIMD;
 
   [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnAfterSalesInvHeaderInsert', '', false, false)]
    local procedure OnAfterSalesInvHeaderInsert(
        var SalesInvHeader: Record "Sales Invoice Header";
        SalesHeader: Record "Sales Header")
    begin
        SalesInvHeader."Package Number" := SalesHeader."Package Number";
        SalesInvHeader.Modify();
    end;
 
 
 
 
 
 
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,138 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,279 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,192

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans