0

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?

1 Answer 1

1

There are two scenarios are there -

  1. Users are internal users, means they are part of Salesforce user list.
  2. User are 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 URL parameter. I believe you just need to update one/two fields. Lets 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 constructor you can update the record. Since you have recordId and data(if its 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.

4
  • 1
    Note that the action of updating a record immediately on access to a page (or lightning component) is frowned on by Salesforce - this is one of the things they disallow during a security review for app exchange packages unless you can convince them it's OK. I agree with Ysr Shk that you really must encrypt data (again a Salesforce security review requirement) and that you should ensure that the URLs "expire" (by being time limited, again a security review requirement).
    – Phil W
    Commented Aug 10, 2020 at 7:13
  • @PhilW - a bit off-topic, how the expire thing happen? some param in URL? or timestamp in record itself to check the expiry? or config?
    – Ysr Shk
    Commented Aug 10, 2020 at 7:38
  • 1
    We hold a special field on our Contact that is a token (a random 32 character string), and other special field that is a token expiry (date/time). These get generated when we generate the link; the token is included on the link and must match the token stored on the Contact. If the token matches then we only accept the execution of the URL if the token has not yet expired. This could be made more generic by actually managing "expiring token" instances that hold these two values plus the contact ID. That way you could have multiple concurrent tokens if required. We didn't need this.
    – Phil W
    Commented Aug 10, 2020 at 8:43
  • Gotcha. Thank you for information!
    – Ysr Shk
    Commented Aug 10, 2020 at 9:11

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