Issue using DeleteUser_Role and CreateUser_Role

Issue using DeleteUser_Role and CreateUser_Role

  

Hi,

I'm creating a UI to allow certain users with permissions to view and manage the users of their application. This is an alternative to using Service Center because we really need the user management integrated in our solution.

One of these requirements is the ability to assign/remove Roles from a user. To accomplish this, I've added a dependency for the User & User_Role outsystem tables and trying to use the DeleteUser_Role and CreateUser_Role functions.

It seems like the DeleteUser_Role does not work, because if I delete a User_Role and try to recreate it then I get a duplicate key error. It seems like the User_Role is never deleted.

Are there any restrictions to delete or create User_Role associations in OutSystems, or am I missing something else?

I am using a personal environment and trying to do this while logged in.

Thank you!

DA

Solution

Hi David,

Why not use the built-in "Grant<Role>" and "Revoke<Role>" actions that are automatically created whenever you create a new Role in your application?

Edit:

OK, thinking a bit more about this you probably can't use the built-in actions because your screen needs to dynamically list whatever Role is granted to the User.

Are you sure you're passing the correct ID to the DeleteUser_Role action?

Solution

Hi Aurelio,

Indeed. I need a more dynamic solution.

After further investigation, I was not using the correct ID in the delete action. After reviewing this code further, I have finally fixed it.

Thank you for your help!