Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

How to Delete Enterprise Roles in bulk using Role Keys

Samujjal_Ghosh
New Contributor
New Contributor

We have duplicate enterprise roles. There are certain roles which have users and certain which don't but the roles have same name. We have fetched the details which roles have users and which don't along with the Role keys.

Now we want to delete the duplicate roles which do not have any users.

5 REPLIES 5

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @Samujjal_Ghosh,

Currently, there isn't a direct method for bulk deleting roles.
You can, however, deactivate roles in bulk by adjusting their status via a CSV file. Alternatively, the Enhanced query feature allows you to streamline this process by deactivating roles and appending "DELETED" to their names using the role key. For instance:

SELECT
R.ROLEKEY AS ROLES__PRIMARYKEY,
CONCAT(R.ROLE_NAME, '-DELETED') AS ROLES__ROLE_NAME,
'0' AS ROLES__STATUS
FROM
ROLES R
WHERE
R.rolekey = '1'

Thanks.

If you find the above response useful, Kindly Mark it as "Accept As Solution".

Samujjal_Ghosh
New Contributor
New Contributor

Hello,

We tried this with 1 role and got an error in custom querry as:

ERROR - Custom Query Job could not be executed -
Query contains Delete, Truncate, DROP,
FOREIGN_KEY_CHECKS which are not allowed-SELECT
R.ROLEKEY AS ROLES__PRIMARYKEY,CONCAT(R.ROLE_NAME,
'-DELETED') AS ROLES__ROLE_NAME,'0' AS
ROLES__STATUS FROM ROLES R WHERE R.rolekey =
'1735'

 

 

Hello @Samujjal_Ghosh,

I have tested the above query it is working fine in version 24.2,

sudeshjaiswal_2-1713279659765.png


Can you please try to enable "Show Delete Role ButtonDisplay" in global config,(PFA Screenshot for reference) and rerun above query.

sudeshjaiswal_0-1713279322282.png

Thanks

If you find the above response useful, Kindly Mark it as "Accept As Solution".

It seems you have tagged wrong version to orignial post hence @sudeshjaiswal  provided enhanced query 

Please use below Query for custom Query

UPDATE ROLES SET ROLE_NAME = CONCAT(ROLE_NAME, '-INACTIVED'), STATUS = '0' WHERE ROLEKEY = '1735';

 

Make sure you tag proper version when you create initial post to get proper suggestion

rushikeshvartak_0-1713327328929.png

 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hello @rushikeshvartak ,

Nice Catch, if thats the case.

Thanks

If you find the above response useful, Kindly Mark it as "Accept As Solution".