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
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.

Example

1// Plans Eligibility (PATCH) via Connect API
2
3// 1) Build the patch input
4ConnectApi.InsurancePlansEligibilityPatchInputRepresentation input =
5    new ConnectApi.InsurancePlansEligibilityPatchInputRepresentation();
6
7// Required: contextId from a prior eligibility session (POST response)
8input.contextId = '0000000i14tq18g00291764218838971ecb8e4a0905c434cbe3f9beeb9f0739e';
9
10// Plans to add
11ConnectApi.InsuranceGroupPlanInputRepresentation addPlan =
12    new ConnectApi.InsuranceGroupPlanInputRepresentation();
13addPlan.planId = '0rgSG0000000fjBYAQ';
14input.addedPlans = new List<ConnectApi.InsuranceGroupPlanInputRepresentation>{ addPlan };
15
16// Plans to remove
17ConnectApi.InsuranceGroupPlanInputRepresentation removePlan =
18    new ConnectApi.InsuranceGroupPlanInputRepresentation();
19removePlan.planId = '0rgSG0000000fUlYAI';
20input.deletedPlans = new List<ConnectApi.InsuranceGroupPlanInputRepresentation>{ removePlan };
21
22// 2) Execute the PATCH with the same Group Census Member Id
23String memberId = '0r6SG00000091EbYAI';
24
25try {
26    ConnectApi.InsurancePlansEligibilityOutputRepresentation result =
27        ConnectApi.InsuranceGroupBenefitsFamily.patchInsuranceCheckPlansEligibility(
28            input,
29            memberId
30        );
31
32    System.debug('Eligibility (PATCH) result: ' + JSON.serializePretty(result));
33} catch (Exception e) {
34    System.debug('Eligibility (PATCH) error: ' + e.getMessage());
35}