I'm trying to figure out a user friendly way to pass messages to users from my Apex code. I have a trigger which fires after insert/update of a lead, which then filters the list of updates and triggers a @future method which pushes the lead data out to an external web service and updates the converted account with some of the returned values.
I'd like to do the following (where X, Y and Z are any number of leads from 1 to 50)
- notify the user converting the leads that leads X, Y and Z will be exported (I'll know this during the trigger execution).
- notify the user whether the export succeeded or failed (which will be known for each of X, Y and Z when the @future method runs).
What is the recommended way to pass this information back to the user? I'd prefer not to use email (as this would trigger one email per record, which is pretty spammy and unpleasant). Is there another way to inject notification messages into a page? I've tried ApexPages.addMessage() but it doesn't seem to do anything for me (no error, but no notice either).