Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to disable Open In Microsoft Office Button from All Forms in D365FO

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
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,151 Super User 2024 Season 2 on at
    How to disable Open In Microsoft Office Button from All Forms in D365FO
    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.
  • gsbsrk b Profile Picture
    gsbsrk b 692 on at
    How to disable Open In Microsoft Office Button from All Forms in D365FO
    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
    André Arnaud de Cal... 291,151 Super User 2024 Season 2 on at
    How to disable Open In Microsoft Office Button from All Forms in D365FO
    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.
  • Martin Dráb Profile Picture
    Martin Dráb 229,963 Most Valuable Professional on at
    How to disable Open In Microsoft Office Button from All Forms in D365FO
    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?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,151 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,963 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans