Thursday, 27 September 2018

Dynamics CRM : Export Security Role


In CRM as a developer sometime we need to see permission given to Security role.
Dynamics CRM/365 we need to open security role to check permission in that security role.
But there is no provision to export Security role permission.

Case Study: -
Developer X is working in an organization as support engineer. He was not part of implementation team.
User requested role given in each security role permission in excel sheet.
It is time consuming job to open each security role and make excel sheet manually with all permission.

Solution: -
To tackle this case study, I have created a XrmToolBox Plugin which help Developer X.
User can see permission given in each security role to entity.
User can see Miscellaneous Privileges.
User can export all Privileges based on selected Security role.
Download XRMToolBox from given URL and install. https://www.xrmtoolbox.com/
Install “Export Security Role” Plugin in your XRMTollBox using plugin store.

























If you are not able to find “Export Security Role.
Go to given link.

Download Plugin

If you are using XrmToolbox Version- 1.2019.6.33 Download from here:

Download 1.2019.6.33

And download plugin from here. Install in XRMToolBox by clicking Settings->Path->Storage folder->Plugin folder.
Copy assemblies in Plugin folder.









































Connect your organization and open plugin Export Security Role.













Click on “Retrieve Roles” and select your security Role.
Now you will see list of all security roles in role list.





Now when you select any security role it will show all Privileges for selected security role.

































If need to search specific entity enter logical name in search box.











Click on Export button to export privileges in excel.
















As a result, you will see a excel file with Security role name is create with all privileges.





























Now Developer X will easily able to find and share permission based on security role.

Note: - Plugin based on .net framework 4.5.2. Microsoft office required to export result.

Follow my blog so you will not miss my new upcoming blogs.

40 comments:

  1. I like that the visibility to Teams and Users that the security role is assigned to are shown. However, just clicking on a Business Unit and a Security Role did not show any of the permissions on the screen as shown in your explanation. What did I miss?

    ReplyDelete
  2. Hey Santosh thank you for your effort! I did experience the same thing. All permissions are either set as "None" or "Organization", with no "Business Unit" or "User" or "Parent: Child Business Units" values.

    ReplyDelete
    Replies
    1. Hi Hani,
      Thanks for reply.
      I have verified your reply and I can see other permission also like "user", "business unit". Try with other security role.
      Miscellaneous privileges can be organization only.

      Delete
  3. Hi Santosh, even i faced the same issue, either its organization or none, other privileges are not showing up.

    ReplyDelete
    Replies
    1. Issue is fixed now and latest code in avaliable in given link.
      Please try and share your comment.
      https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip

      Delete
  4. Hi Santosh, I'm not able to get the plugin to show up in the xrmtoolbox store. Is it still publsihed? If so, do you have more instructions how to add it?

    ReplyDelete
    Replies
    1. Hi Bassio,
      I think xrmtoolbox yet not verifed plugin. I have shared plugin source in download link https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip
      You can download and add in your plugin folder.

      Delete
  5. Great work but when i export the roles, i only get "None" or "Organization". Not the others. Is it possible to fix?

    ReplyDelete
    Replies
    1. Issue is fixed now and latest code in avaliable in given link.
      Please try and share your comment.
      https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip

      Delete
  6. Hi Folks,

    Issue is fixed now and latest code in avaliable in given link.
    Please try and share your comment.
    https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip

    ReplyDelete
  7. Looking for custom CRM software development company? Try our CRM services! Augurs provide a wide range of custom CRM development services tailored to the industry-specific requirements.

    ReplyDelete
  8. When i try to export is showing this error: Is not working, Helppppp please

    System.Runtime.InteropServices.COMException (0x8002000B): El índice no es válido. (Excepción de HRESULT: 0x8002000B (DISP_E_BADINDEX))
    en Microsoft.Office.Interop.Excel.Sheets.get__Default(Object Index)
    en ExportSecurityRole.ExportRole.btn_Export_Click(Object sender, EventArgs e)
    en System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
    en System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
    en System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
    en System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
    en System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
    en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    en System.Windows.Forms.Control.WndProc(Message& m)
    en System.Windows.Forms.ToolStrip.WndProc(Message& m)
    en System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ReplyDelete
    Replies
    1. Make sure you have installed Microsoft office 365. and try again.

      Delete
    2. Nice, i have a question, Should I have Office 365 installed offline

      Delete
    3. Yes, Or you can download zip file from
      https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip
      It have required office DLL

      Delete
  9. Nice Blog! Sharing a good information and Any information to Microsoft-Based ERP Solution is specialized to help companies obtain reports and business analysis, while helping increase efficiency, accuracy, and customer satisfaction. By enabling you to automate and streamline projects across company divisions and locations, Microsoft Dynamics Solution helps you manage people, projects, and profitability. For more information to visit our website:-https://solutionsco.com

    ReplyDelete
  10. When I try to export is showing this error, could you help me please

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.Runtime.InteropServices.COMException (0x8002000B): Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
    at Microsoft.Office.Interop.Excel.Sheets.get__Default(Object Index)
    at ExportSecurityRole.ExportRole.btn_Export_Click(Object sender, EventArgs e)
    at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
    at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
    at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ToolStrip.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ReplyDelete
    Replies
    1. you can download zip file from
      https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip
      It have required office DLL

      Delete
  11. I'm getting this erros
    Ocorreu uma exceção sem tratamento no aplicativo. Se você clicar em Continuar, o aplicativo ignorará esse erro e tentará continuar. Se clicar em Encerrar, o aplicativo será encerrado imediatamente.

    Índice inválido. (Exceção de HRESULT: 0x8002000B (DISP_E_BADINDEX)).
    Consulte o final desta mensagem para obter detalhes sobre como chamar a
    depuração just-in-time (JIT) em vez desta caixa de diálogo.

    ReplyDelete
    Replies
    1. you can download zip file from
      https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip
      It have required office DLL

      Delete
  12. Very nice services provided by you. Thank you for imparting this useful information here. Website Designing Companies in Bangalore | Web Design Agency in Bangalore | Web Design Services in Bangalore

    ReplyDelete
  13. Thank you for such a well written article. It’s full of insightful information and entertaining descriptions.Emotional Intelligence Certification | Emotional Intelligence Training | Emotional Intelligence Coaching

    ReplyDelete
  14. This is excellent information. It is amazing and wonderful to visit your site...
    Event management company in chennai

    ReplyDelete
  15. Hi Santosh, i am getting below error while retrieving the roles.

    Unable to cast object of type 'Microsoft.Xrm.Tooling.Connector.CrmServiceClient' to type 'Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy'.

    ReplyDelete
    Replies
    1. It seems you are not using updated XRMToolbox.
      Update your Xrmtoolbox and
      you can download zip file from
      https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip
      It have required office DLL

      Delete
  16. Hi Santosh, This error is resolved but another error occurring for one of the custom Entity

    "An error occurred: An error occurred while parsing EntityName. Line 1, position 302."

    ReplyDelete
  17. you can download zip file from
    https://github.com/santoshCRM/Export-Security-Role/blob/master/Assembly.zip
    It have required office DLL

    Can you try with Trail instance first for more comparison.

    ReplyDelete
  18. Hi Santosh, I´m getting an error retrieving roles with your Export Security Role:


    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.InvalidCastException: Unable to cast object of type 'Microsoft.Xrm.Tooling.Connector.CrmServiceClient' to type 'Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy'.
    at ExportSecurityRole.Helper.createConn(IOrganizationService Service)
    at ExportSecurityRole.ExportRole.btn_retRole_Click(Object sender, EventArgs e)
    at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
    at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)

    ReplyDelete
    Replies
    1. Use Xrmtool box version XrmToolBox v1.2019.2.32
      Download from :- https://www.xrmtoolbox.com/releases/

      Delete
  19. Hi, im having the same problem as guys above me.

    Unable to cast object of type 'Microsoft.Xrm.Tooling.Connector.CrmServiceClient' to type 'Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy'.

    Can you help us, please?

    ReplyDelete
    Replies
    1. Use Xrmtool box version XrmToolBox v1.2019.2.32
      Download from :- https://www.xrmtoolbox.com/releases/

      Delete
  20. Use Xrmtool box version XrmToolBox v1.2019.2.32
    Download from :- https://www.xrmtoolbox.com/releases/

    ReplyDelete
  21. This comment has been removed by the author.

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  23. i get this error when hit "retrieve roles"

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.InvalidCastException: Unable to cast object of type 'Microsoft.Xrm.Tooling.Connector.CrmServiceClient' to type 'Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy'.
    at ExportSecurityRole.Helper.createConn(IOrganizationService Service)
    at ExportSecurityRole.ExportRole.btn_retRole_Click(Object sender, EventArgs e)
    at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
    at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
    at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ToolStrip.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.3416.0 built by: NET472REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
    ----------------------------------------

    WHAT SHOULD I DO WITH THE OFFICE FILE?

    ReplyDelete

Dynamics - PDF Generator

In 2017, a third party provide a solution that use to generate PDF from CRM templates. In recently, Dynam...

Test