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

memberId

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

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());
}