[Management] – Search Role in K2 [EN Version]

Today we’ll take about role in K2. We know that K2 Role use to manage group of user when we didn’t use AD group. We can create and manage role using Management console in workspace (K2 version prior to K2 Five) or using K2 Management site (K2 version 4.7 and K2 Five). But the thing that still missing is search function.

Imagine that if we have more than 100 roles in system and want to add/remove user in role or want to know which user belong to which role? How can we solve this problem? Today I got a tool for you. Please follow below step

  • Create stored procedure using script below in any database that can reach K2. You can also create in K2 database but please be aware. Because when we upgrade version or patch the stored procedure may be disappear.

CREATE PROCEDURE [dbo].[sp_FindRoleByUser] (

@pUserName NVARCHAR(447)

) AS


SELECT i.[Name]

FROM   [K2].[Identity].[Identity] i

INNER JOIN    [K2].[Identity].[RoleItem] r

ON     i.ID = r.IdentityID

WHERE  i.[Type] = 2

AND    r.[FQN] = @pUserName


After deploy you can use form at {url}/Runtime/Runtime/Form/UserRole.Form/

Hope this can help you when working with role 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s