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...
Suggested Answer

Disable item renumbering from item card

(0) ShareShare
ReportReport
Posted on by

We have an issue where a user has accidentally gone into the number series on an existing item, then chose OK which prompts to update the number. We would like to either add a new second dialog that warns that the change will update the number, or see about disabling the OK button. Any guidance on adding another prompt dialog to this?
pastedimage1679503751242v1.png

pastedimage1679503906511v2.png

pastedimage1679503925011v3.png

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    You will need customization in code to achieve that. And i am not sure if it is worth it. Remember that if any user by accident have renamed and item you can just rename it back to what you want it to be.

    By doing the customization you talk about you will block that option - and I am not sure I would recommend that.

  • kjjson Profile Picture
    on at

    Thanks Inge, even if I could get another pop-up that displays the message that they are about to change the number, or change the prompt that comes up now to include that, it would be better.

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

    Hi, If you don't need to enter the number manually, just disable the option below, and an error will be prompted after clicking OK.

    pastedimage1679535198351v1.png

    pastedimage1679535229005v2.png

    pastedimage1679535272418v5.png

    pastedimage1679535256627v4.png

    Hope this helps.

    Thanks.

    ZHU

  • kjjson Profile Picture
    on at

    ZHU, thank you, unfortunately we do need to number things manually. I am still looking for some way to just add a new prompt when the OK button is selected. Is there an easy way to do that?

  • Suggested answer
    Shawnsauve Profile Picture
    1,093 on at

    Yes, it is possible to add an additional prompt dialog to warn the user before updating the number series on an existing item. One way to achieve this is by customizing the existing code that prompts the user to update the number series.

    You could create a new function that shows an additional prompt dialog, which can be called before the existing code is executed. For example, you could add a confirmation dialog with a message such as "Are you sure you want to update the number series? This action cannot be undone." The function could return a boolean value indicating whether the user confirmed the update or not.

    Once the confirmation dialog function is created, you can modify the existing code to call this function before executing the code that updates the number series. If the user confirms the update, the existing code can be executed as normal. If the user does not confirm the update, the code can exit without making any changes.

    Alternatively, if you are not comfortable modifying the existing code, you could also consider disabling the OK button instead. This can be achieved by adding some JavaScript to the page that the user interacts with. The JavaScript could listen for changes to the number series field, and disable the OK button when a change is detected. You could also add a warning message near the field to notify the user that the OK button is disabled until they have corrected the number series.

  • kjjson Profile Picture
    on at

    Shawn, This was very helpful, I am trying to identify how to what to call before the code is executed. Right now, I am just trying to run a message that the change is going to take place if they continue, but it is coming up after the change takes place. Any guidance from here?

    I have tried both:

    EventSubscriberInstance = StaticAutomatic;

       [EventSubscriber(ObjectType::Page, Page::"Item Card", 'OnBeforeValidateEvent', 'No.', true, true)]

       local procedure CheckItemChangeBeforeValidateEvent(var Rec : Record Item)

       begin

          Message('You are about to change this item number');

       end;

    And

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Approvals Mgmt.", 'OnRenameRecordInApprovalRequest', '', true, true)]

    procedure ConfirmChange()

    begin

      MESSAGE('You are about to change this item number');

    end;

  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    You have to use OnBeforeRenameEvent as No. is a Primary Key field.

    [EventSubscriber(ObjectType::Table, Database::Item, 'OnBeforeRenameEvent', '', false, false)]

       local procedure OnBeforeRenameEventItem(var Rec: Record Item; var xRec: Record Item; RunTrigger: Boolean)

       begin

           if not Confirm('You are about to change this item number. Do you want to continue?') then

               Error('');

       end;

    pastedimage1681702940607v1.png

  • kjjson Profile Picture
    on at

    Mohana,

    Thank you so much. One last question, do you know if it is possible to capture what the new item would be in the message, for example, "You are about to change this item number to 'NEWITEM'. Do you want to continue?

  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    Yes.

    [EventSubscriber(ObjectType::Table, Database::Item, 'OnBeforeRenameEvent', '', false, false)]

       local procedure OnBeforeRenameEventItem(var Rec: Record Item; var xRec: Record Item; RunTrigger: Boolean)

       begin

           if not Confirm(StrSubstNo('You are about to change this item number to %1. Do you want to continue?', Rec."No.")) then

               Error('');

       end;

    pastedimage1681738404533v1.png

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,229

#2
Jainam M. Kothari Profile Picture

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

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans