postInsuranceCheckPlansEligibility(plansEligibilityInputParam, memberId)

Check the eligibility of a group census member for a given set of plans and create a new eligibility context.

API Version

65.0

Requires Chatter

No

Signature

public static ConnectApi.InsurancePlansEligibilityOutputRepresentation postInsuranceCheckPlansEligibility(ConnectApi.InsurancePlansEligibilityPostInputRepresentation plansEligibilityInputParam, String memberId)

Parameters

plansEligibilityInputParam

memberId

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

Example

// Plans Eligibility (POST) via Connect API

// 1) Build the input with plans
ConnectApi.InsurancePlansEligibilityPostInputRepresentation input =
    new ConnectApi.InsurancePlansEligibilityPostInputRepresentation();

// Each plan requires a Contract Group Plan Id
ConnectApi.InsuranceGroupPlanInputRepresentation plan1 =
    new ConnectApi.InsuranceGroupPlanInputRepresentation();
plan1.planId = '0rgSG0000000fXPYAY';

// Optionally add coverages under the plan if applicable
// plan1.coverages = new List<ConnectApi.InsuranceGroupPlanInputRepresentation>{ /* coverage items */ };

// Provide one or more plans
input.plans = new List<ConnectApi.InsuranceGroupPlanInputRepresentation>{ plan1 };

// 2) Execute the POST with the Group Census Member Id
String memberId = '0r6SG0000008n3CYAQ';

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

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