You need to sign in to do that
Don't have an account?
Trying to create lwc to display toast message when standard page record changes.
I am trying to create a Lightning Web Component that I can put on the standard Account page and have a custom toast message displayed every time the page is edited. The LWC would not have any UI. It would be hidden and respond to the record update event from the standard page.
I was able to do something similar with aura using this example: http://www.sfdcpanda.com/custom-user-message-in-standard-lightning-page/
But this example didn't work quite right. It only seemed to fire when you edited the page through the edit button. If you edited a field by clicking the pencil on the field it didn't fire the event.
So I am trying to do the equivalent with LWC in hopes that it will work correctly from either edit method.
Any help would be appreciated.
I am not sure if this would be possible but just a small thought will it not be possible to fire the toast message on save button instead of edit button?
Regards,
Anutej
Please go through the following link for showing the toast related information.
https://rajvakati.com/2019/02/02/lightning-web-components-toast-messages/
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.use_toast
https://newstechnologystuff.com/2019/03/16/custom-toast-component-in-lightning-web-components/
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Sachin Arora
www.sachinsf.com
All the toast examples use events that are tied to the user editing a field or clicking a button on the lwc.
My lwc does not have any UI so there wouldn't be anything like -
<lightning-input label="Title" value={_title} onchange={titleChange}></lightning-input>
<lightning-button label="Show Notification" onclick={showNotification}></lightning-button>
Aura handles it with <force:recordData recordUpdated="{!c.handleRecordUpdated}"
This works even if the aura lightning component has no UI controls
But even this only works when you click the Edit button. It does not fire for inline edit.
On save would work as well, but again, I can't figure out how to have my lwc recognize that the parent (standard page) is being saved.
Thanks,
Kevin.