Announcements
No record found.
How do i give create permisson on programatically in c# for a custom entity?
*This post is locked for comments
Hi Raghav,
AddPrivilegesRoleRequest and AddMembersTeamRequest under Microsoft.CRM.SDK.Messages might help.
AddPrivilegesRoleRequest is to add an existing privilege to an existing role.
AddMembersTeamRequest is to add an existing user to an existing team, thus make the security roles applied for the team to start applying for the user.
docs.microsoft.com/.../microsoft.crm.sdk.messages.addprivilegesrolerequest
Regards,
Abby
Hi,
Programmatically you can use GrantAccess and RevokeAccess messages. Check this -
docs.microsoft.com/.../sample-share-records-using-grantaccess-modifyaccess-revokeaccess-messages
Hope this helps.
How to give privilege to custom entity addprivelegerolerequest is giving for OOTB i think,Can you provide any code for custom entity security roles privilege change?
I gave it a try myself. AddPrivilegesRoleRequest does work with custom entities, not just OOB entities.
------------------------------
The challenge is to find the PrivilegeId, there are a few ways to find it. If you are using on-prem dynamics, you can find them in the database.
If you are using online, there is a little trick:
1. Find instance web API URL (this can be found in Developer Resources), and append /privileges?$select=name
2. Search in the result from the URL from step1 for the privilege id (e.g. if your custom entity is new_test, and you want to find the create privilege: search for prvCreatenew_test)
The code would be something like this:
var addPrivilegesRequest = new AddPrivilegesRoleRequest { RoleId = roleId, Privileges = new[] { new RolePrivilege { PrivilegeId = prvCreatenew_test, Depth = PrivilegeDepth.Basic } } }; svc.Execute(addPrivilegesRequest);
Do you want to update Security role?
Please clarify if you need to give create privilege for a record only.
You can also use access team and add member in that access team to give read access for a specific record.
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.