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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

How to enable/disable delete button in the Attachment(Document Handling) based on Enum status

(0) ShareShare
ReportReport
Posted on by 2,172

Hello all,

In my customized transaction form, I want to disable delete button in the attachment(Document Handling) based on enum status in the transaction header of the form. How to achieve this?

*This post is locked for comments

I have the same question (0)
  • Johnkrish Profile Picture
    781 on at

    HI Anand,

    This link could be useful.

    dynamicsuser.net/.../164689.aspx

    regards,

    johnkrish

  • Johnkrish Profile Picture
    781 on at

    Hi Anand,

    If your form template is None, then why cant you try the autodeclaration property Yes and access the button Enabled property.

    Regards,

    Johnkrish

  • Anand AX Profile Picture
    2,172 on at

    Hello John,

    I cant get you ..! Can you please explain it in brief? I want to disable delete button in the attachment based on the status field.

  • Johnkrish Profile Picture
    781 on at

    Hi Anand,

    In the document handling form set the Delete button Auto Declaration property to Yes and through code access the button Enabled property.

    for accessing Enum values you have to declare a variable for the enum first, after in if condition you can check.

    Regards,

    John

  • Verified answer
    Maciej Obojski Profile Picture
    610 on at

    Hi,

    please have a look inside DocuView form, doReSearch method, around line number 160 and below. Hopefully you will see that there is already some code there that sets variable called 'allowEditBasedOnActualForm'.

    In my installation there is even some code for Norway, which checks the calling table and sets the variable based on some fields - looks like exactly what you need ?

       if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoNO]) &&

          (testCursor.TableId == tablenum(CustInvoiceJour) || testCursor.TableId == tablenum(ProjInvoiceJour)))

       {

           switch (testCursor.TableId)

           {

               case tablenum(CustInvoiceJour):

                   custTable = CustTable::find(CustInvoiceJour::findRecId(testCursor.RecId).InvoiceAccount, false);

                   break;

               case tablenum(ProjInvoiceJour):

                   custTable = CustTable::find(ProjInvoiceJour::findRecId(testCursor.RecId).InvoiceAccount, false);

                   break;

           }

           if (custTable.EInvoice)

           {

               allowEditBasedOnActualForm = true;

           }

       }

    Thanks,

    Maciej

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans