web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Assign security policy to multiple roles

(0) ShareShare
ReportReport
Posted on by

Is it possible to assign a security policy to multiple roles, either by assigning a policy to duties and privileges rather than a role, or by any other way?

What I want to do is have a restriction on a table (record level security) which restricts records based on some criteria. I then want to assign this policy to multiple roles.

I noticed on the policy, there is a property called "ContextType". I assume that If I set this to "RoleProperty" and then set "ContextString" to a value, I can assign this to multiple roles. If so, how do I set a role to include this policy?

I would appreciate help as I had trouble finding detailed documentation on this (if it even exists).

Thank you,

Nehal

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    299,397 Super User 2025 Season 2 on at
    RE: AX 2012 R2 assign security policy to multiple roles

    Hi Nehal,

    You are almost there... :-)

    You can type in the context string a certain value, e.g. "XDSpolicy". The security roles also do have a property in the AOT for defining a context string. Enter the value used at the security policy in the context string property of the roles where it should be applied to. Then you have created the link with multiple roles.

  • Nehal Mistry Profile Picture
    on at
    RE: AX 2012 R2 assign security policy to multiple roles

    Hi André,

    I see it now. I have two concerns regarding this:

    1. Can I assign multiple ContextString values to a role (can I separate multiple values using commas)? I will need this if I want multiple policies for a role and also have the policies apply to other roles.

    2. This is part of software that I am distributing to multiple customers. Is this something a system administrator can modify easily? It seems that it is but I just want to make sure there would not be any problems with this.

    Thanks,

    Nehal

  • André Arnaud de Calavon Profile Picture
    299,397 Super User 2025 Season 2 on at
    RE: AX 2012 R2 assign security policy to multiple roles

    Hi Nehal,

    Great questions. I tried before to enter multiple values, but did not have luck with it, so it probably would not work. Neither on the security policy and the roles.

    You can have multiple policies using the same context string.

    If you want to make combinations, you would probably need to duplicate policies and roles.

    If you add/change security policies and/or roles it is stored in the application. So if you ship the complete model store to the customers, it will be in there as well. An administrator can access the AOT and can make changes as well. Be sure he is familiar with these concepts or give him some training.

    When you do not want to ship this to every customer, you can consider creating a separate model and ship various models to your customers.

  • Nehal Mistry Profile Picture
    on at
    RE: AX 2012 R2 assign security policy to multiple roles

    André,

    I thought so. I think I will just have to create multiple policies.

    Yes, I'll definitely have documentation and training available for customers.

    Thank you. You have been very helpful.

    Regards,

    Nehal

  • MBrown1185 Profile Picture
    2,710 on at
    RE: AX 2012 R2 assign security policy to multiple roles

    Hi André,

    I have the same requirement as mentioned above: Apply multiple context strings to a single role.

    One of the workarounds I could think is to create dummy Security Roles just for the Security policies and them to Users or other roles as a sub-role to apply policy.

    Just wondering if this approach has any disadvantages in the longer run.

    Best Regards,

    Michael Brown

  • Ravi_Kesharwani Profile Picture
    on at
    RE: AX 2012 R2 assign security policy to multiple roles

    Could you please post some examples ? As its very difficult to find to paas them. In role its in form of label and in policy its only a string.

  • macl Profile Picture
    35 on at
    RE: AX 2012 R2 assign security policy to multiple roles

    I have tried use ContextString on a role and on a policy and it didn't work. Changing on RoleName works perfectly but I want to use this policy in many roles...

    Is there any additional settings apart from ContextString on policy and ContextString on Role?

  • André Arnaud de Calavon Profile Picture
    299,397 Super User 2025 Season 2 on at
    RE: AX 2012 R2 assign security policy to multiple roles

    Hi macl,

    If it is related to all roles, you can also use the policy without any ContextString or RoleName. Can you elaborate what exactly is not working? Do you have multiple policies on the same role and/or table(s)?

  • macl Profile Picture
    35 on at
    RE: Assign security policy to multiple roles

    Hi Andre,

    I would like to link the policy to some roles not all of them.

    I have one policy on HcmWorker table connected to a query which returns CustTable records for current user only. When I set ContextString on the policy and role I can see all customers :(

  • André Arnaud de Calavon Profile Picture
    299,397 Super User 2025 Season 2 on at
    RE: Assign security policy to multiple roles

    Hi macl,

    What exact role did you use? Note that when the system user role has been assigned to a user, XDS is not active.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans