The CreatorCon Call for Content is officially open! Get started here.

how to delete a particular user from User(sys_user) table.

praveen1231
Tera Contributor

Hi,

My scenario is - I had created a new catalog item variable called User(Referrence field). When I select any particular user (e.g. Abel Tuter) and submit the catalog item record, selected user (Abel Tuter) needs to delete permanently from the User(sys_user) table. Please let me know if you have any idea regarding this. Thanks

1 ACCEPTED SOLUTION

Hi @praveen1231,

 

I understand that is the requirement, however part of our job is to give advice.

 

Not every requirement should be fulfilled if there are better ways to do it, or if it is better to not do it at all.

 

I'll leave it up to you what to do with that. Just keep in mind a trusted advisor is valued even more than a good developer. 

 

That being said, since you are using a catalog item, the easiest way to handle it, is to create a flow with flow designer.

 

Lookup the user from the variables, update the user, or delete if there is is no other way forward.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

11 REPLIES 11

Igor Kozlov
Tera Expert

I also think deleting user is not the best solution.

Guess you actually need not a deletion, but not able to find user in the system.

 

So beside solution provided by Peter you can try following:

1. have a new boolean field Deleted. You use some existing field the will flag user as deleted.

2. Hide "deleted" users from everyone but admins.

Add Query | action_query   business rule for user table that look like  

 

(function executeRule(current, previous /*null when async*/) {

	if(!gs.hasRole('admin')){
		current.addQuery('deleted', false); //use your filed name and condition here
	}

})(current, previous);

 

3. in your catalog item just update the field to flag user as "deleted"

Hi @Igor Kozlov,

 

Thank you for supporting my direction. I like the idea you suggest, but OOTB the active field actually does the same. Only admins can see inactive users.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.