You may know that any user can run any report in Business Central if they have access to the related tables. But did you know you can limit access to some of these reports?
You can develop a password-protected report, which will allow only users with the password the ability to run. Learn how in the following steps.
The first step is to add a new field called “Password” on the extended “User Setup” table using the code below.
Now we will add the new field “Password” to the extended “User Setup” Page.
Next, we will create a new Single Instance codeunit to set up business logic using the code below.
Then, we will create a new standard dialog page asking the user to enter the password before running password-protected reports.
Create a new standard dialog page using all the code below.
Note: The step above is a one-time process that creates the framework for any report to be set as password-protected.
Now, we are ready to set any report in our Business Central system password-protected.
In the following example, I’m going to use the “Aged Accounts Receivable NA” report (ID:10040) to set as a password-protected report.
Using the code below, you can set any report as a password-protected report.
Now, let’s take a look at how it works when we try to run the report.
First, you need to set up a password on the user setup page for the users you want to allow to run a password-protected report.
Now, Run the Aged Accounts Receivable report. It will open a request page to set up filters & options as per your need.
Now, if you click any button, Send to, Print, or Preview, it will open the below dialog box to enter a password to run the report.
Voila, your Business Central report is now protected, and you can dictate which users can access this information.
Permissions are a vital part of any company’s cyber security protocol. If you need any help with your Business Central’s settings and security, give us a call, we'd love to help.