function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfadm sfadmsfadm sfadm 

How to update a record in Salesforce via landing page linked to an email?

I have a landing page linked to an email and in the email there is a button. After the button is clicked I need to be able to connect to Salesforce and update a field in the Contact record.
Please advise how it can be achieved in Salesforce?
AbhishekAbhishek (Salesforce Developers) 
There are two scenarios that are there -

Users are internal users, which means they are part of the Salesforce user list.
User is customer/non-Salesforce users, who might not have login credentials with them
When you're sending mail, send one id(probably some hash key matched up with time and recordId) as a part of the URL parameter. I believe you just need to update one/two fields. Let's assume isRead field you need to update(if single field, you can do it easily, if multiple pls add it in URL as a Get params[in case of sensitive data encode and encrypt it]).

For the first case/Internal users :

You can have a plain VF page/Lightning component with isUrlAddressable implemented. There you can show some loading sign and on load, in the constructor, you can update the record. Since you have recordId and data(if it's present in URL parameter).

For the second case/non-logged In Users

Create a site page(or public API, it still requires site). And do the same reading URL parameters and update the record.

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.