---
schema_version: "1"
id: 03592f97b35bbf4c9429b43a6585718709f8ca45bba255782b1c30a51fdb8684
title: patchInsuranceCheckPlansEligibility(plansEligibilityInputParamWithContextId, memberId)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsGroupBenefits_patchCheckPlansEligibility.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsGroupBenefits_patchCheckPlansEligibility.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 493459ce7435181b6b1a3cab3226f9932ec5a4361dcfcde765a22b2c598946bc
description: Check the eligibility of a group census member for a set of added and deleted plans within an existing context.
---
# patchInsuranceCheckPlansEligibility(plansEligibilityInputParamWithContextId, memberId)

Check the eligibility of a group census member for a set of added and deleted plans within an existing context.

## API Version

65.0

## Requires Chatter

No

## Signature

public static ConnectApi.InsurancePlansEligibilityOutputRepresentation patchInsuranceCheckPlansEligibility(ConnectApi.InsurancePlansEligibilityPatchInputRepresentation plansEligibilityInputParamWithContextId, String memberId)

## Parameters

**plansEligibilityInputParamWithContextId**

- Type: [ConnectApi.InsurancePlansEligibilityPatchInputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_insurance_plans_eligibility_patch.htm "Input representation for checking plan eligibility by updating an existing context.")
- Input representation that contains the context ID and the plans that must be added or removed.

**memberId**

- Type: String
- ID of the group census member whose eligibility must be checked.

## Return Value

Type: [ConnectApi.InsurancePlansEligibilityOutputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_insurance_plans_eligibility.htm "Output representation for the employee plan eligibility check.")

## Example

// Plans Eligibility (PATCH) via Connect API

// 1) Build the patch input
ConnectApi.InsurancePlansEligibilityPatchInputRepresentation input =
    new ConnectApi.InsurancePlansEligibilityPatchInputRepresentation();

// Required: contextId from a prior eligibility session (POST response)
input.contextId = '0000000i14tq18g00291764218838971ecb8e4a0905c434cbe3f9beeb9f0739e';

// Plans to add
ConnectApi.InsuranceGroupPlanInputRepresentation addPlan =
    new ConnectApi.InsuranceGroupPlanInputRepresentation();
addPlan.planId = '0rgSG0000000fjBYAQ';
input.addedPlans = new List<ConnectApi.InsuranceGroupPlanInputRepresentation>{ addPlan };

// Plans to remove
ConnectApi.InsuranceGroupPlanInputRepresentation removePlan =
    new ConnectApi.InsuranceGroupPlanInputRepresentation();
removePlan.planId = '0rgSG0000000fUlYAI';
input.deletedPlans = new List<ConnectApi.InsuranceGroupPlanInputRepresentation>{ removePlan };

// 2) Execute the PATCH with the same Group Census Member Id
String memberId = '0r6SG00000091EbYAI';

try {
    ConnectApi.InsurancePlansEligibilityOutputRepresentation result =
        ConnectApi.InsuranceGroupBenefitsFamily.patchInsuranceCheckPlansEligibility(
            input,
            memberId
        );

    System.debug('Eligibility (PATCH) result: ' + JSON.serializePretty(result));
} catch (Exception e) {
    System.debug('Eligibility (PATCH) error: ' + e.getMessage());
}