How do I display information in a toast message using Apex? I want to show the message via a trigger on the Opportunity object. I can't use addError, because addError prevents the user from saving the record, which isn't what I want.
I've read about ApexPages.addmessage, but that's not working for me. When I try it, it causes the error "There's a problem saving this record. You might not have permission to edit it, or it might have been deleted or archived. Contact your administrator for help."
How do I do this? I'm looking for a solution that works in a trigger on the regular Opportunity object, not in a Lightning component.
My code: ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, 'My info message'));