How to Duplicate a Role with Permissions in ERPNEXT

Hi everyone,

Could someone assist me with this?

Is there a way to create a custom role duplicating an existing role and its associated permissions?

In my case, I’m trying to duplicate the “Sales Manager” role, but the “Duplicate” option only copies the role data and not the associated permissions.

Go to the Custom DocPerm (to do this, open the doctype and search for Custom DocPerm, then open it). Export the Sales Manager role, update the new name, and import it. After that, check if it works.

You can’t simply duplicate the role because it’s set at the doctype level, and sometimes it’s not stored in Custom DocPerm. So, make sure to check it from your side.

Thanks, @NCP for your valuable input it’s working. Is the same way for import Role Permission for Page and Report

To clarify @NCP 's reply,

  1. Go to New Data Import, Select ‘Custom DocPerm’ as the document type, and Import type ‘Insert New Records’, and Save.
  2. Download template and filter out for desired role whose permissions you wish to duplicate.
  3. Create the new Role in ERPnext
  4. Replace the Role name in the template with the newly created name.
  5. Import.
2 Likes

:raised_hands:

2 Likes

thanks for update @federico_calvo :+1:

@NCP the “Custom DocPerm” export is not copying all permissions.

For example, for “Accounts Manager” role it exports five roles only (shown in picture), whereas many roles are assigned when I checked in “Role Permissions Manager

Is there any way to copy all of them?

Custom DocPerm Exported CSV File:

1 Like

@NCP yes, i have the same problem, i need to add a new role and duplicate existing role permissions.

When data exporting “Custom DocPerm” , only the customized roles permissions are exported, not the default ones that were already in the system, but the un-exported part actually is the majority of the role permissions, and is the part I needed to duplicate.
Thanks!
Key