APEX API – Verified Privacy Policy Link

Updated on March 20, 2023

Users can use this APEX API to receive a Privacy Site URL present on particular Contact or  Lead record in an encrypted format. After passing the parameters in API, it will verify all the details and will return the verified Privacy Site URL for verified Contact or Lead record.

APEX call to get a verified Privacy Site URL for Contact/Lead as follows.

 String input = '{"email":"marksth@gellcsop.com","siteId": a0L2w000000ihrrEAA","sendEmail":true,"individualInfo":{"FirstName":"Mark","LastName":"Smith","Giver_Number__c":"555"}}';
PCCC_DM.SelfServiceInfo obj = PCCC_DM.SelfServiceInfo.parse(input);
String response = PCCC_DM.SelfServiceUtils.generateEncodedURL(obj);
System.debug('response: ' + response);

The details of all these parameters are as follows – 

  • email – This field contains the Email Id of the Contact/Lead record that the user wants to send an Email with the Privacy Site Url.
  • siteId – The appropriate Privacy Site record ID.
  • sendEmail – To send the Privacy Site URL via email to the Contact/Lead. Pass the boolean value “True” or “False” based on the requirement.
  • individualInfo – The user can pass Individual info to verify the user and receive the appropriate Privacy Site URL.


At least one Privacy Site record must be created.

To create a Privacy Site record refer to the following link.

Solution Steps

1. Navigate to a Salesforce record (Contact record in this example) and get all the required information to pass in the API call.

E.g. First Name, Last Name, Giver Number.

Note – Make sure an Individual record is created with all the necessary fields which are going to be used in the REST call and that it is associated with the corresponding Contact record.
Refer article Grouping Rule for Individual  to create Individual record for Contact/Lead record

2.  Navigate to the Privacy Site record and copy the record Id from the URL (a0L2w000000ihrqEAA in this example).

3. Open the Salesforce Developer Console.

4. The APEX API will return a Privacy Site URL and a success message(hasError: false).

Note: To check the Privacy Site Portal user can copy the generated link and open it in a new tab. Also if a user has passed the sendEmail parameter’s value as true then Contact must have received an email containing the Privacy Site URL.