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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Change No in Posted Sales Invoice

(0) ShareShare
ReportReport
Posted on by 95

Hi,

In my company they want to change the number of a posted sales invoice. I have used the Rename function as you can see in the following image:

pastedimage1648475022875v2.png

The problem is that when the function is executed the following error appears:

pastedimage1648475106494v3.png

The user is the administrator and has the SUPER permission set, so he has all permissions.

Could someone tell me how I could change the value of that posted sales invoice?.

Regards.

I have the same question (0)
  • Verified answer
    MahGah Profile Picture
    15,529 on at

    Hi

    We have kind of similar report but looks like developer added some permission on top of the report. I hope this help

       UsageCategory = Administration;

       ApplicationArea = All;

       ProcessingOnly = true;

       Permissions = tabledata 112=rm,

           tabledata 113=rm;

  • Suggested answer
    Dallefeld Profile Picture
    211 User Group Leader on at

    Caution!!!

    Checking the posted sales invoice number will make the 'Find Entries' feature not work for the invoice that you are changing.

  • Verified answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at

    For audit purpose, posted document or ledgers have more restriction on it.

    When you modify the Sales Invoice Header, you need to make sure you specify the permission on the object that does the modification.

    Example : Permissions = TableData "Sales Invoice Header" = m;

    Check Codeunit 391 "Shipment Header - Edit" for reference.

    When you are renaming the Invoice No. (primary key), all the related table will be renamed as well. However, there might be place where table relation is not defined properly and will not get renamed. Make sure you double check all other tables when you rename the No.

    Get clarification why you want to change the No. after you posted the invoice.

    Why not change the No when you are posting the invoice ? It is much safer that way.

  • Suggested answer
    Dallefeld Profile Picture
    211 User Group Leader on at

    Teddy, I do not think that the No. field is a field that has a table relation in Customer Ledger, General Ledger, Value Entry tables (just examples) therefore the document number in those tables will not be changed which is one of the reason that renumbering of posted documents is not allowed.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    You are totally correct Kim! There is no table relation between the invoice table and the ledger tables. So renaming sales invoice can put your database in a strange state.

  • Verified answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at

    Hi, In BC, if you need to modify the posted data, you need to use Permissions Property in your code.

    More details: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-permissions-property

    But be aware that this is not secure, so it is generally not recommended.

    PS: In fact, you can refer to the following standard feature.

    pastedimage1648511244992v1.png

    pastedimage1648511249949v2.png

    Hope this helps.

    Thanks.

    ZHU

  • Verified answer
    Alfredo_Iorio Profile Picture
    1,262 on at

    I agree with Inge and Kim.

    Changing the document number of a posted invoice could potentially break a database unless the routine includes further actions like check that the new document number does not exists already, updating document lines and all all related entries.

    The hardest part of the job is to update the the G/L - Item Ledger Relation table that holds data about the invoice and the shipments. The G/L entry is linked to value entries that are lined to the ILE table.

    Any code developed to change the document number of a posted invoice must update all the entries to maintain traceability and cost applications. If not, any report on customer profitability will return incorrect data.

    The job is doable but it's an ugly piece of work.

    As a consultant I would not work on any code that touches those tables.

    If the requirement is to use different invoice numbers for different customers/ sales types, I suggest developing something different based on the Posting No. Series on the Sales Header.

    The option could allow users to choose a No. Series in the Sales Header before posting.

  • MiguelRospa Profile Picture
    95 on at

    Thank you all for responding.

    All your responses have provided some interesting insight. My summary would be very similar to the one Alfredo just wrote. It would be possible to change the registered invoice number (by setting the permissions by code) but this would only update those tables that have an established relationship. The other tables would not be updated and this would require an effort that is not worth what it would contribute.

    Setting the serial number before registering would not have solved the problem, but that explanation is out of this thread. Thank you anyway.

    A comment will be established on the invoice and with that the issue will be resolved.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans