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 to disable Open In Microsoft Office Button from All Forms in D365FO

(0) ShareShare
ReportReport
Posted on by 692
Hi ,
 
I want to disable Open in Microsoft Office button from all forms in D365FO which is system defined button.
I tried via security roles it got disabled, but it's not allowing me to export from the form grid right click /Export all rows/ function.

Can we do it through the code??
 
I wrote COC for formRun class it's working fine, but for few forms (All vendors) it's giving error /Object not set to an instance of an object error.
final class FormRun_Extension
{
    public void init()
    {
        FormMenuButtonControl       officeButton;
      
        #SysSystemDefinedButtons
        next init();
        officeButton = this.control(this.controlId(#SystemDefinedOfficeButton)) as FormMenuButtonControl;
      
        if (officeButton)
        {
            officeButton.enabled(false);
        }
      
    }
}
Any code suggestions please 
 
Thanks in Advance.
 
Regards,
Krish
I have the same question (0)
  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at
    When code is throwing an error, a good next step is identifying the place where it happens. Use the debugger for this purpose.

    By the way, why do you want to make F&O less useful for your users?
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at
    Hi Krishna,
     
    There is a difference between Open in Excel and Export to Excel. If you want to allow users export the grid details and not have them using the Dynamics 365 connector in Excel, you can manage this with security. For Open in Excel, users should have access permissions to data entities used on the forms. If you create roles without the public access for the data entities, the users will not have access to the entities listed in Open in ExcelExport to Excel is the same as exporting the details from the grid.
  • gsbsrk b Profile Picture
    692 on at
    Thanks, Drab and Andre for your quick reply.
     
    Hi Drab,
     
    Now I'm not getting the error, earlier application is not compiled, I did full build on model.

    Hi Andre,
     
    If you want to allow users export the grid details and not have them using the Dynamics 365 connector in Excel, you can manage this with security
     
    I tried using Security configurations by giving the deny access to this class ExportToExcelExportForm of System user role, but it's stopping the Grid Export. ( Both are disabling Open in Excel and Export to Excel).

    ​​​​​​​I want to stop Open in Excel .

     

    For Open in Excel, users should have access permissions to data entities used on the forms. If you create roles without the public access for the data entities, the users will not have access to the entities listed in Open in Excel.
     
    Creating a role for all data entities in system will take lot of time.

    Thanks,
    Krish
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at
    Hi Krish,
     
    With the security approach, you don't need to create a role with all data entities. When a user doesn't have permissions, it will not show up. Maybe you are now thinking of adding deny permissions to all data entities, but that is not needed and not best practice. Ensure the data entities are not part of the role, that will do the job already.

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans