Can we call Lwc or Aura component inside VF Email Template

313 Views Asked by At

I have a requirement in which email notification we have to provide a link which will redirect approver immediately to the approval page. I found one relevant solution mentioned in below URL

URL :-

https://www.vandeveldejan.com/create-an-approval-notification-with-visualforce-email-template-containing-quote-and-quotelineitems/

which says to create visualforce component, I wanted to check if we can user LWC instead of visualforce.

As I am new to LWC expecting some help to understand if we can call LWC component inside Visualforce Email Template.

I have followed the same steps but wanted to know If I can use LWC compoenent or Aura instead of VF page compoenent

https://www.vandeveldejan.com/create-an-approval-notification-with-visualforce-email-template-containing-quote-and-quotelineitems/

2

There are 2 best solutions below

0
eyescream On

No.

Think about it. You want to create an email that on opening would immediately start a browser (hope the user is logged in to salesforce) and navigate to some page? without user clicking anything? That'd be a security nightmare. Can I send you an email which will use your Amazon account to order some stuff for me ;)

You can't run javascript inside emails (and even if you could - email clients should block it) so no LWC runtime... How would it even login to SF to pull data?

You need to learn Visualforce for this email template or send the email straight from apex (write the email's plaintext/html body with apex)

0
Axelf3000GT On

You can create public community, create public page and add your custom AURA or LWC component. Then copy link to this public community with your new page and add recordId in URL. I did this in Lightning AURA.