How I can rollback deleted roles from Systems/Role entity?

Hi Folks,

In my application using Users and Roles from Systems/User and Systems/Roles.
Role entity has many more roles but I need few particular of them that's why I keep whatever required and others are deleted but due to this application is not working and also I am not able to rollback deleted roles.

So I need your help to rollback all roles whatever I have deleted from Systems/Role entity.

Kindly let me know if require more details.

Thanks



Hi Meer,

Did you delete Roles from an application? Can you still see them in the Roles folder of the Logic tab?

If you need their record in the database, they still exist in the Role Entity in System, but they are disabled (IsActive = 0). You'll have to recreate them manually in the module they were in.

Afonso Carvalho wrote:

Hi Meer,

Did you delete Roles from an application? Can you still see them in the Roles folder of the Logic tab?

If you need their record in the database, they still exist in the Role Entity in System, but they are disabled (IsActive = 0). You'll have to recreate them manually in the module they were in.

Hi Afonso Carvalho, Greetings!

Thanks for reply.


Yes, this Role folder is still in my application with these two mentioned options, but I have create UI for Role entity with Editable records to add, Edit or delete options. So using this I have deleted Roles (whichever could not be in use) from Role entity.

In Role entity only showing me whichever roles I didn't deleted but some roles showing repeated i.e. doubled the records. 

As you mentioned IsActive option so from where I can set this true? 




Hi Meer,


Look the role entity 


also you can retrive from Publised version you can download and copy in you running version and publish application again.


Thanks

Rahul Sahu

Rahul Sahu wrote:

Hi Meer,


Look the role entity 


also you can retrive from Publised version you can download and copy in you running version and publish application again.


Thanks

Rahul Sahu

Hi Rahul Sahu,
Thanks for your reply.

I have applied filter Is_Active=False to Role entity so there is no single record showing, if there is no records in entity with Is_Active false so how we can get that records and change its state to true.




I assume you implemented a hard delete in your screen (remove lines instead of setting IsActive = 0) so those roles are gone from the Role entity, there's no flag to change. If you need those records, you would have to revert to a database backup.

If you don't have a database backup, you'll have to recreate those Roles by hand in your module.

You should be very wary of hard deleting records from internal entities like Role or Entity - this sort of behaviour is not documented so the platform can act in unexpected ways.

Afonso Carvalho wrote:

I assume you implemented a hard delete in your screen (remove lines instead of setting IsActive = 0) so those roles are gone from the Role entity, there's no flag to change. If you need those records, you would have to revert to a database backup.

If you don't have a database backup, you'll have to recreate those Roles by hand in your module.

You should be very wary of hard deleting records from internal entities like Role or Entity - this sort of behaviour is not documented so the platform can act in unexpected ways.

Thanks Afonso Carvalho,

I will take care of this ahead.

May be due to Role issue User application is not working also. Please see screenshot below



I would like to create new users from here, but application is now providing the option to create new user.

Kindly let me know what I can do to run User application.

Thanks

I suspect the Users application is attempting to use the missing Roles. Can you open ServiceCenter and show us a screenshot of the error stack trace?

Afonso Carvalho wrote:

I suspect the Users application is attempting to use the missing Roles. Can you open ServiceCenter and show us a screenshot of the error stack trace?

Yes, There is showing  unknown role..

Please see Service Center error log screenshot below




I checked the User_Show screen in the Users module and it references these four Roles:



Do you still have all four of these in your Role entity?

Afonso Carvalho wrote:

I checked the User_Show screen in the Users module and it references these four Roles:



Do you still have all four of these in your Role entity?

Yes, I have Administrator, SuperUser, TeamMember, TeamManager, Employee are available in Role entity.

For Users UI screen there showing  Registered, TeamManager, TeamMember and UserManager are selected.


I was banking on a missing Role essential to the Users espace - if they are all there, it's a bit harder to validate.

There is something you could try to diagnose and confirm that the problem is missing data: try creating another application with a screen that needs those roles and then access it. If it still errors out, then the problem is definitely missing data and you'll have to restore the Role entity data. If you can access it, then the problem might not be the Role entity data, but something else.

Solution

Afonso Carvalho wrote:

I was banking on a missing Role essential to the Users espace - if they are all there, it's a bit harder to validate.

There is something you could try to diagnose and confirm that the problem is missing data: try creating another application with a screen that needs those roles and then access it. If it still errors out, then the problem is definitely missing data and you'll have to restore the Role entity data. If you can access it, then the problem might not be the Role entity data, but something else.

Afonso Carvalho, Thanks for your reply.

I was checked out error log there was showing "unknown role". but issue is resolved by I was tried to run application from Service Center multiple times and also created same Users screen in another application so application is automatically running means without any change in code. For User application I have created some new employees / users with assigned available RoleId of Roles  then I can able to login by that users so now whole application is working as expected.

But did not able to recovered deleted Roles. :(

Thanks for your great support. (Y)


Solution

No problem Meer! Glad you got it sorted out.