---
schema_version: "1"
id: 60c14d9ae266ce27966f077b8d24c4f83e28eea08369da0f2e6d3dcf5db2669f
title: Create Consent Records with an Apex Job for Vaccine Eligibility
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/service/264-0-0/vaccine_packages_create_consent_records.md
canonical_url: https://help.salesforce.com/s/articleView?id=service.vaccine_packages_create_consent_records.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 70383ffc8fd3b5aa22248c8441e6164e251ed210322af35463851d90a8433c32
description: With a scheduled Apex job, you can regularly create consent records for the leads that are generated from your vaccine eligibility sign-up form. Simply schedule the job, and it runs at the specified time when you have new leads from the sign-up form.
products:
  - Salesforce Platform
release: "264"
---
# Create Consent Records with an Apex Job for Vaccine Eligibility

With a scheduled Apex job, you can regularly create consent records for the leads that are generated from your vaccine eligibility sign-up form. Simply schedule the job, and it runs at the specified time when you have new leads from the sign-up form.

The job uses the schedulable class `AsyncConsentRecordCreator` to create the consent records for the leads.

Each batch performs these actions on the lead records:

- Fetch Lead records with `WasIndividualCreated__c = false`.
- If the record has `HasNotificationConsent__c = true`:
    1. Create an Individual record.
    2. Create a Contact Type Consent record.
    3. Update the lead record with `WasIndividualCreated__c = true` and link it to the Individual record.

1. From Setup, enter Apex Classes in the Quick Find box, then select **Apex Classes**.
2. Click **Schedule Apex**.
3. Enter the job name. We recommend Consent Record Creation, so you know what kind of record the job creates.
4. Enter AsyncConsentRecordCreator in the search bar and select it.
5. Specify the start and end dates for the Apex scheduled class. If you specify a single day, the job runs only once.
6. Specify a preferred start time. The exact start time depends on service availability.
7. Save your changes.

After the job is completed, you can see its information on the [Apex Jobs](https://help.salesforce.com/articleView?id=code_apex_job.htm&language=en_US) page, such as whether it passed or failed, how long it took to process, and the number of records processed.

#### See Also

- [Set Field Permissions in Permission Sets and Profiles](https://help.salesforce.com/s/articleView?id=platform.users_profiles_fls.htm&type=5&language=en_US)
- [Store Customers’ Data Privacy Preferences](https://help.salesforce.com/s/articleView?id=platform.individuals_store_data_privacy.htm&type=5&language=en_US)
- [Schedule Apex Jobs](https://help.salesforce.com/s/articleView?id=platform.code_schedule_batch_apex.htm&type=5&language=en_US)