Create Authorization Form Consent record using APEX API

The Authorization Form Consent record is created which is used as proof related to each customer’s consent to Terms & Conditions, Privacy policy, etc. This will help the user to create a full picture of the customer’s consent to the various authorization forms. In this APEX call, the API method is used to create a corresponding ‘Authorization Form Consent’ record that is linked to both the Individual Id and the T&C/Privacy Policy Id. 

The APEX API call for Authorization Form Consent record creation is as follows:-
 

map < String, Object > inputDataItem = new map < String, Object > {
PCCC_DM.PCL_Constants.CONSENT_GIVER_ID => ‘0PK0b000000Ckz4GAC’,
PCCC_DM.PCL_Constants.PRIVACY_SITE_ID => ‘a0R0b00000BAshKEAT’,
PCCC_DM.PCL_Constants.AUTH_FORM_TEXT_ID => ‘0cN0b0000000001EAA’,
PCCC_DM.PCL_Constants.STATUS => ‘Signed’,
PCCC_DM.PCL_Constants.CONSENT_CAPTURE_SRC_TYPE => ‘Web’,
PCCC_DM.PCL_Constants.CONSENT_CAPTURE_SRC => ‘Web’
};
map < String, Object > inputData = new map < String, Object > {
PCCC_DM.PCL_Constants.AUTH_FORM_REQUEST => new List < Object > {
inputDataItem
}
};
system.debug(PCCC_DM.PCL_AuthFormConsentService.createAuthFormConsent(inputData));


The details of all input parameters are as follows – 

  1. CONSENT_GIVER_ID  is an Individual ID of Contact/Lead record.
  2. PRIVACY_SITE_ID is the lookup of a field that will be useful to link privacy sites so as to store consents for the Privacy Policy, Terms & Conditions or End User License agreements.
  3. AUTH_FORM_TEXT_ID Manages the text associated with the authorization form. Users can also include a summary to describe the form’s purpose and display to customers when asking for their consent. This is the required field that can be hardcoded.
  4. STATUS is the standard picklist field on authorization consent form object with values as ‘Seen’ or ‘Signed’ (Restricted Picklist Field). This is the optional field that can be hardcoded.
  5. CONSENT_CAPTURE_SRC_TYPE is a standard picklist field on the authorization consent form which highlights communication preference for the consent captured (Restricted Picklist Field). This is the required field that can be hardcoded.
  6. CONSENT_CAPTURE_SRC is a standard field (Text Area 255)  on the authorization consent form which populates the channel or source by which the consent is acquired. This is the required field that can be hardcoded.

Solution Steps
 

Prerequisite – It is necessary to have at least one record of salesforce standard object “Authorization Form”, “Authorization Form Text” and  Cloud Compliance’s custom object “Privacy Site”.
 

1. Navigate to a salesforce contact record for which users want to manage their consents. This contact record will have an association with the Individual.

Note– If the individual is not associated with the contact record, the user can run the auto Individual batch provided by “Cloud Compliance”. It will automatically create individual records for each Contact record based on defined criteria. 

For more details about this batch refer to this link Grouping Rules for Individual.

2. Navigate to that Individual record to get its Id. Copy the record Id from the URL. The id is highlighted in the URL for reference in the screenshot below –

3. The user next needs to go to the “Privacy Site” record and get the Privacy site id.

4. Also, get the “Authorization Form Text” records id 

5. Open the Salesforce Developer Console. Prepare the createAuthFormConsent method along with the input parameters which will be passed to the apex script. Click on the Execute button. The authorization form consent creation API is already mentioned above.

6. This API returns Record creation Status as True in case of successful Authorization form consent creation and false otherwise. It also contains a record Id that is authFormSFId.

7. The authorization form consent record which can be called as Proof of Acceptance record will be as follows – 

Note – NAME is a standard field on the Authorization Form Consent object. If the user does not pass this value through APEX API  then it will be populated as a current date-time stamp with the “CC” as the prefix.