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 :
Microsoft Dynamics AX (Archived)

How to enabled/disabled Delete Records submenu in File menu.

(0) ShareShare
ReportReport
Posted on by 120

Hello all,

I create a customizaton form.

In this form, i want to enabled/disabled Delete Record (Alt F9) submenu of FILE menu (following image).

How to code with X++?

Alex

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Jonathan  Halland Profile Picture
    11,310 on at

    Hi Alex.

    You need to set the "allow delete" property on your form data source to "NO"

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Alex,

    You can write this code on the active method of your datasource where you want to toggle this property. So if your condition, where you want to allow delete is true, you can set the allowDelete property of the datasource as true.

    In the below example if for example you want to allow delete if qty of purchline is less than 5 then write the below code in Active method of purchLine datasource:

    if (purchLine.purchQty< 5)

    {

    purchLine_ds.allowDelete(true);

    }

    else

    {

    purchLine_ds.allowDelete(false);

    }

    You can also find many references in standard AX code on how to call this function.

    Hope this helps,

    Priyanka Agarwal

  • Alex Huynh Profile Picture
    120 on at

    Hi Jonathan, Priyanka

    Thank you so much!

    Alex

  • Jonathan  Halland Profile Picture
    11,310 on at

    Hi Alex. Please can you mark the solutions as verified

  • Community Member Profile Picture
    on at

    For the Document handing form even if I set the form only ds DocuRef AllowDelete == No, but the 'Delete Record' menuitem is still not disabled.  How can I get access to this actual menuitem to set the flag myself through the Form init event?

  • Suggested answer
    Andrzej Lapinski Profile Picture
    45 on at

    If you mean like a button (menu item) then you can set AutoDeclaration property on this  button (design -> your_button -> properties) to yes and use button.enabled(false) wherever you want inside the scope of this form. Additional information about form control properties can be found here: msdn.microsoft.com/.../aa845161.aspx

  • Jonathan  Halland Profile Picture
    11,310 on at

    Hi

    Access to these buttons should be controlled by standard AX behaviour. I.E. Based on whether the datasource allows for deletion or not. Trying to customise this will cause problems across the board.

    Setting this on the datasource on your form in the AOT is just controlling the default behaviour when the form is opened. Take a look in the doReSearch method of this form and you will see that the deletion is reenable/disabled based on other rules. If you want to never allow deletion on this form add the line docuRef_ds.allowDelete(false); to the bottom of this method to overwrite any standard rules.

  • Suggested answer
    Community Member Profile Picture
    on at

    same option delete record enable/disable option on attachment form on Account payable -> Lines -> Attachment ->File -> Delete Record (enable) please reply if anyone know about this issue.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Hi Waqas qADIR,

    can you explain your issue in a new thread?

  • Community Member Profile Picture
    on at

    actually we not given any rights to user to delete attachment file but they can delete it from Delete Record  which is attach in Account payable voucher lines attachment.even our Consultant have no idea about this option to hide this button from File submenu Delete Record

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans