+ Start a Discussion
Priya AakankshaPriya Aakanksha 

LWC--I want to create Pop up message(Toast) when record type is changing.

I want to create Pop up message when the record type is changing from pre-sales person to salesperson.
The pre-sales person will lose the record after changing the record type at that moment I want to pop up(Toast) message as "successfully record gone to sales" for the Pre-sales person.

Please suggest to me some idea From LWC or any other way
ShivankurShivankur (Salesforce Developers) 
Hi Priya,

Check out similar implementation done by another community members:
https://salesforce.stackexchange.com/questions/292987/how-to-show-toastevent-only-when-specific-field-on-the-opp-changes

This would give you an idea how you can approach with your particular business requirement.

Hope above information helps. Please mark as Best Answer so that it can help others in future.

Thanks.
Suraj Tripathi 47Suraj Tripathi 47
Hi Priya,
Greetings!

1. Create a checkbox in the object of Record Type which you want to change.
2. Create a process builder which runs when record is update and check the condition ISCHANGED(RecordTypeId).
3. If RecordTypeId Changed, update the checkbox to true which you created at the first step.
4. Create a VFPage that shows you the toast when the checkbox is true.
5. Update that field to false on the VF page after showing the toast.
6. Use that VF Page in the detail page (Set size 0) to run JS Only from VF Page.

If you find your Solution then mark this as the best answer. 

Thank you!

Regards,
Suraj Tripathi
Maharajan CMaharajan C
Hi Priya,

You can use the Platform Event , Process Builder or Trigger , LWC to acheive this.

1. Create the Platform Form Event in your org. Setup => Platform Event.

2. Create the LWC Component and subcripe the above platform event in JS using lightning/empApi.

3.  Create process builder or apex trigger to publish th platform event to subscribers.

4. Place the LWC component in record detail page. In metaxml add <target>lightning__RecordPage</target> Interface to make the component available in record page. In Html below lines are enough. Only you have to work on component JS to handle the platformevent.
<template>   
</template>
the same kind of scenario is handled in below links:
https://newstechnologystuff.com/2020/08/15/platform-event-in-lightning-web-components/
https://github.com/rahulmalhotra/Platform-Event-Toast-LWC


The below links also will help you :
https://sfdclesson.com/2021/04/17/subscribe-platform-event-in-lightning-component/

Thanks,
Maharajan.C