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

Apex coding


Can any one help me out of this problem?

this is the requiremnt: 

During contact creation process we need to enforce users to accept Legal  Disclaimer. Once users accepts the legal disclaimer we need to allow them to create Contact and then system is going to predefault and lock "Opt in" flag to 'N' and   "DO Not Email", "Do Not Mail" , "Do Not FAX" flags to "Y" . We need to enable users to use Contact opt In process. This contact Opt in process will allow users to send opt In email to customer, this email will have opt in and opt out link for the customer. If the user choose to opt in, this will be an inbound email to SFDC which drives the update to 'Opt In" flag to "Y" and in  turn update ""DO Not Email", "Do Not Mail" and "Do Not FAX" flags to "N". Else "Opt In","DO Not Email", "Do Not Mail" and "Do Not FAX" flags remains 'N".



For this what is the solution?






VisualForce page to override 'New' contact button, and apply the opt-out logic.


Generate a unique ID (non-SF), add it to the contact in a field behind the scenes.


Auto-generate an email to the contact email address (which, ironically, would violate your Do Not Email field, but that's your issue ;)) that has the return email set to your incoming SF email address and the unique ID in the subject or body. 


Parse the body of the incoming email for the unique ID, plus whatever text information you want to represent 'opt-in', and update the contact as required.