How do we generate a toast message while clicking on a action button where we will be calling the flow.How can we do that using auto launch flows?
-
What are you actually doing in autolaunch flow? What have you tried so far? Where did you get stuck?– sanket kumarCommented May 28, 2021 at 5:55
-
If you want any visual feedback, then the simplest option is a one screen visual flow (configuration option)– manjit5190Commented May 28, 2021 at 6:16
-
We are actually having a button in an object and after clicking on it it will generate a toast message how can we do that using auto launch flows not using screen flows?– user9203403Commented May 28, 2021 at 6:29
2 Answers
(Non-trigger) auto-launch flows have no ability to present messages since they run in a "headless context" - as the documentation says, they run in the background and are asynchronous. You can initiate them from all sorts of places:
- Through the UI
- By a standard or custom REST API
- By a scheduled job
- In async code
- etc.
Only the first scenario would have any way to show something on the UI.
I could imagine writing a a custom LWC, e.g. toaster
, that polls (or uses the emp API to be notified of creation of) records of a specific type of object, e.g. Toast__c
, perhaps associated with the current User, and have this generate toasts from the records' details (deleting the records once the toast is shown). You could then have an auto-launch flow that, when the conditions are met, creates the required record(s) of this custom type Toast__c
, setting required properties as needed. As long as you include the custom toaster
LWC in your Salesforce UI pages you get toasts appearing from nowhere when the flow generates the records.
You might be able to apply something similar with platform events too.
NB: Trigger-based auto-launch flows also cannot present data for many of the same reasons.
I had a similar requirement. I used this package. It might help you too: https://unofficialsf.com/show-toast-flow-action/