SECURITY IN D365 F&O (III)
I would like to address briefly the last topic about Security in D365 F&O, i.e. field level access. Granting update access to a limited number of fields or makes a field invisible can be performed in D365 F&O.
In our case, an organisation asks you to give access to raise a sales order but they don’t allow the user to amend the sales price, or the discount amount provided as they are inherited from the sales contracts.
You can of course cover that requirement in D365 F&O. The first step is to identify the menu item and the fields that you need to restrict access to.
Preliminary steps
Navigate to Accounts Receivable > Orders > All sales orders
Open a sales order
Right click on the Unit price field
Click on Form Name: SalesTable
Extend the Administration tab
The menu item is SalesTableDetails in our case
The field to restrict access to is SalesPrice stored in the SalesLine table
Do the same steps for those fields:
Discount (LineDisc)
Discount percent (LinePercent)
Net amount (LineAmount)
Development
Open Visual Studio on your VM and open your project
Navigate to User Interface > Menu items > Display
Select SalesTableDetails
Click Open designer
Right click and select Find references
You can see that this menu item is included in those following privileges:
Select SalesTableDetailsMaintain
Right click and select Find references
You can see that this privilege is included in those following duties:
Select SalesOrderMaintain
Right click and select Find references
You can see that this duty is included in those following roles:
It is a little bit cumbersome to identify this way the security role to adjust.
You can also select the menu item and click Addins > View Related roles
Then, open the excel spreadsheet.
Duplicate in project the role TradeSalesClerk we would like to adjust and remove the standard duty SalesOrderMaintain
Duplicate in project the duty SalesOrderMaintain we would like to adjust and assign the custom duty CustSalesOrderMaintain to the custom security role CustTradeSalesClerk
Remove the standard privilege SalesTableDetailsMaintain from the custom duty CustSalesOrderMaintain
Duplicate in project the privilege SalesTableDetailsMaintain we would like to adjust and assign the custom privilege CustSalesTableDetailsMaintain to the custom duty CustSalesOrderMaintain
Find the entry point SalesTableDetails and add the data source SalesLine
Then right click on the SalesLine entry and select Add a new data source field for those fields:
SalesPrice
LineDisc
LinePercent
LineAmount
Give a read access to those fields:
Build your project.
Now you can test the new role. You can raise a sales order but if you try to edit the unit price, the field is greyed out.
You can check the first article about security to see how to test your roles.
Another case is a little bit tricky. An organisation asks you to grant update access to credit fields on the customer account.
Perform similar preliminary steps
Add the CustTable to the CustTableListPage menu item
Set the access level of the menu item to Read
Set the access level of the CustTable to Update
It gives update access to all fields on the CustTable. That’s why, we finally need to add new data source fields (Click add a new data source field) to the CustTable for all fields that need to have read access.
It can be quite cumbersome for big tables like this one.
That’s the last article about Security. I will change topics and focus on Electronic Reporting moving forward.