-1

I have a requirement to send an email to individuals who are neither Salesforce users nor community users. Within the email, there is a hyperlink, and when they click on it, I need to update the contact record.

I attempted the following approach: a) I am sending an email when the email address is updated in the contact record. This email contains hyperlinks with the "recordId" and "isEmailVerified" as a parameters.

b) I created a site where I included a "verifyEmailComponent" Lightning Web Component (LWC).

c) When the user clicks on the link in the email, the component opens. In the "connectedCallback" method, I retrieve parameters from the URL, specifically the "recordId" and "isEmailVerified" parameters.

d) To update the record, I make an imperative call to an Apex class from the LWC. However, I encountered an error indicating that You don't have access to that Apex class.

How can I resolve this access issue to the Apex class? or you can suggest another approach.

Thank you.

1 Answer 1

2

You need to set up the Guest User Profile to include access to the Apex Class. Go to the Digital Experience Builder, then click on the gear icon (Settings), then click on the profile link at the bottom of the General settings tab. From there, find the Apex Class Access section, and add your Apex controllers to the profile. After this, your guest users should have permission to call this method. You may also need to add access to objects and fields.

3
  • Thank you for your reply. In my requirement, I cannot create a user or profile on my salesforce instance for an outside user.
    – Amol Girme
    Sep 26 at 5:07
  • @AmolGirme You create neither a user or profile in this setup. The profile is created when you create a Digital Experience to handle unauthenticated access. This is how the system is designed.
    – sfdcfox
    Sep 26 at 12:17
  • Thank you very much. It is working now.
    – Amol Girme
    Sep 26 at 15:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .