I have added a custom button on the Opportunity page which invokes an apex code. The invoked apex code is redirecting to the same Opportunity page.
... PageReference pg = new PageReference('/'+ oppId +'?test=true'); pg.setRedirect(true); return pg;
I would like to add error message after the redirect to the Opportunity page.
Please advise how this can be achieved?