In this example wewill get to know how to implement XDS policy in Dynamics 365 Finance and Operations.
XDS Policy
XDS policy is basically a data security in Dynamics 365 which enables to show only specific data from a specific set of users that has particular role assigned to them.
Lets get into the steps to enable XDS on a table LMS_BookDetails in which data related to only those books which has status set to Available will be visible to the user.
- Create a query consist of the table LMS_BookDetails on which we want to apply xds.
- Add required data source i.e. LMS_BookDetails in the query and then apply ranges on it.
- This is an optional step. If you want to confirm that query is filtering data according to requirement, just create a demo view and add that query in the view. Build your project and sync database. Open the view in table browser to verify if its showing filtered data then it means it will work on xds as well. If the view does not show the desired records, go back and fix your query.
- After creating the query create a security policy. Go to properties and set the query created in step 1. Set the context type to role property.
The ContextString is intended to be used in x++ code to enable/disable policies.
The RoleProperty is defined as context string on the roles. You can then link multiple roles to one or more policies with a certain context string.
The RoleName is used to have a policy enabled for just one particular form.
- Then set the context string to whatever string you want. In our case it is “XDSPracticePolicyString”. This context string will be used for applying xds policy to any role you want.
- Set the following properties as shown in the below image.
- Now for constraint table node in the xds policy. Constraint table is basically table record related to the primary table which will have the xds policy applied on it. It means in our case LMS_BookIssue table will also contains data for only available books status. The properties are set below in the image.
Note: You can skip constraint table if you just want to apply xds on the master table rather than other table which has master table’s primary key as foreign key.
- After that build your project and sync database.
- Then go to dynamics security configuration and select a role. Enter the xds context string in the context string text box , this will make sure that the policy is applied against this role. You can use a single context string for multiple xds security policies.
Note: XDS security will not work if the user has admin role assigned to it.