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

How can I change the behavior of CloseButton in a standart form ?

(0) ShareShare
ReportReport
Posted on by 65

Hi EveryOne

I need change the behaviour of Button "Close" (System Defined Button) in the form VendTable.
When you are creating a new vendor the design of the form change of ListPage (Master of vendors) to Details (New Vendor) and when you close the form in the creating of new vendor the form change the design again to comeback a ListPage (Master of Vendors). So I cant edit the method Close of the form because the form Vendtable has not closed yet (is a unique form with a diferents designs and many behavours).

i need validate it so i need to know when i clicked the button Close in the moment when i´m creating the new vendor and i should be put my code in these moment.

Any ideas?. i found this info from microsoft docs.microsoft.com/.../system-defined-buttons

But its not cleary how can i change the behaviour of CloseButton.

I can hide or enabled the button but Icant go to the method "Clicked" or to go the action.

Thanks for all

I have the same question (0)
  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Perhaps you can check the onClosing event of the form?

  • Lucho2202 Profile Picture
    65 on at

    Yes but this method only excute when you are closing the form (VendTable). in the creation of a new vendor when you click in the Button Close the form never has been closed only it changed the Design to ListPage to see all vendors

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Ok, what is your business requirement? Are you sure you need to hook into the close button? And not the actual creation of the vendor?

  • Lucho2202 Profile Picture
    65 on at

    The requirement is to assure that an address is added to the vendor before closing the form. We used the OnClosing event but it’s not triggered when the form is closed. We also tried to use the ValidateWrite event, but then there is a problem doing the validation in there because to add an address the record in VendTable needs to be created.

    We have tried with multiple events and methods, but we have not found how to avoid the form to closing with no data in the address table

    That's why we thought that maybe we can use the event of the close button to control that event.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    I would just add a dialog/infolog reminding the user about missing address if:

    - Form is closed

    - User leaves current record

    With this approach you should be able to catch most situations. As you noticed, you can't anyway prevent creation of vendor without address, so the best you can do is add notifications for the user.

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 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans