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 :
Finance | Project Operations, Human Resources, ...
Answered

Disable new button based on save button (system generated default button)

(0) ShareShare
ReportReport
Posted on by 97

Hi All,

I am having one requirement that I need to disable the new button after the save button is clicked. New and Save are standard system buttons in form.

Please guide me  where i have to write code.

pastedimage1679659525486v1.png

Thanks in advance.

I have the same question (0)
  • GirishS Profile Picture
    27,827 Moderator on at

    HI,

    If you hide the new button after saving it won't be available for next record creation. I mean it will be disabled all the time until you open and closes the form.

    Can you elaborate what you want to achieve?

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, May I know why do you need to disable the New button. It's a standard functionality to create new records after saving current record. You can check Customer groups form.

  • PJ JohnPaul Profile Picture
    97 on at

    Hi Girish,

    Thanks for the response.

    Actually what i want is after clicking new button,it should get disabled.

    When the user click on save button at the time only new button should get enabled.

    After saving record only ,user should able to click the new button,until the record is saved,user should not able to click on new button

  • PJ JohnPaul Profile Picture
    97 on at

    Hi Mohit,

    Thanks for your response.

    Now its allowing the user to create multiple records,

    we need to restrict that

    For that reason we want to disable new button after save button clicked we can enable the new button again

  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Normally when you click on save button validateWrite method will be called and it will validate the current record and if it's an error it won't allow you to create a next new record otherwise it will allow you create new record.

    This is how it will work.

    If you want the user to won't allow to create next record without giving proper value on the current record you need to add validation for that. Trying to enable and disable a new button is not a good idea, I guess.

    Whatever you are trying to achieve is not possible, I think.

    Thanks,

    Girish S.

  • Suggested answer
    Komi Siabi Profile Picture
    13,109 Most Valuable Professional on at

    JohnPaul,

    Tell us the document where the record is being created.

    Does the document have workflow enabled?

    Does the requirement say, a Maximum of one record per user on the table?

    If yes, you might consider indexes and disallow duplicate.

    Disabling the "New" button to stop multiple record is not an ideal design.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Your requirement is still not clear, generally on click of New button, one record is created. Even if you disable New button and enable it on click of Save button, user still can create multiple records. How are you going to restrict it?

  • Verified answer
    Andrew Xu Profile Picture
    3,877 on at

    Hi PJ,

    You can make it work by overwriting write() method of your data source.

    Clicking button Save will call that method, and you can set 'allowCreate' to false to make button New disabled.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi JohnPaul,

    Is there any business impact in case a user by accident clicks twice on the new button? Sometimes, I also do that, but can delete the wrong record. If there is no business impact, why adding logic to change the standard behavior of the application?

    If you need to have a user creating one record at a time, you can consider developing a creation dialog instead, like the customer creation form, sales/purchase order creation dialog.

  • PJ JohnPaul Profile Picture
    97 on at

    Thanks Andrew for your reply.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans