[SalesForce] Show popup/modal from apex trigger

I have an apex trigger on my custom object which will fire on record insertion or update (before insert before update). Based on certain criteria I would like to show users a modal.

Something like this:enter image description here

So users can click save or cancel and other actions will follow based on user decision. I wonder, is this somehow possible to fire that modal from my trigger, when user clicks on the save button of my custom object edit record page?

The edit and detail page of the record are standard pages, and i am not allowed to make custom Lightning pages to override them.

Best Answer

It is not possible to fire user interface interaction from a trigger, except that throwing an exception in a trigger can result in surfacing an error in a UI context if there is one. For example, throwing an exception in a trigger that is fired due to a user's edit action in a standard page will show an error on that page. However, no further UI-based interaction with the trigger is possible, and all data updates made during the transaction are rolled back.

It is not possible to surface a modal from a trigger and engage in user interaction.

Since triggers run in both UI (Classic/Lightning) interactions and in backend (API/Process/Flow) actions, in many cases there is no UI at all.