Get the selected entity from a Search Entity widget

Lets say I have a client entity and I want to implement a button to delete the client from the database. Although this would probable involve a heavy SQL query, what I truly need is a way to get the selected entity from a Search Entity widget

Is there any way to get the selected entity from outside the search widget? Lets say, from an Automation Command Button?

Firstly, you can’t delete an entity is its been used on a ticket.
Can you not add command buttons within the widget like ticket lister?

Yes @JTRTech, I understand. Thats why I mentioned a heavy SQL query. But the setup is hypothetic. What I want is to access the selected entity from the Entity Search Widget from outside the widget

I know there is a way to Command Buttons from within the widget. I cannot use those because I need more than one button getting the Entity Name for rule execution

When using the Command Buttons option of the widget I have seen:

Select Client=Select

which effectively passes the Entity Name to a command for a rule to catch but I cannot have:

Select Client=Select
Delete Client=Select

Could you pass a single button to an ask question propmt.

{REPORT SQL DETAILS:SELECT TOP 1 e.[Id] FROM [Entities] e JOIN [EntityTypes] et on et.[Id]=e.[EntityTypeId] WHERE et.[Name]='Customers' ORDER BY e.[Id]:F.Id}

This pulls out Entity ID from the selected customer entity. It was a piece of code Q used in his Purchase History tutorial.