getInsuranceMemberEligiblePlans(memberId, shouldIncludeDependents)

Get the enrollment plans for which a group census member and their dependents are eligible.

API Version 

65.0

Requires Chatter 

No

Signature 

public static ConnectApi.InsuranceGetMembersPlans getInsuranceMemberEligiblePlans(String memberId, Boolean shouldIncludeDependents)

Parameters 

memberId

  • Type: String
  • ID of the group census member.

shouldIncludeDependents

  • Type: Boolean
  • Indicates whether to include eligible plans for the member’s dependents in the response (true) or not (false).

Return Value 

Type: ConnectApi.InsuranceGetMembersPlans

Example 

Here’s an example of how to invoke the Insurance Get Member Eligible Plans API from Apex code.

1// Get Member Eligible Plans via Connect API (simple version)
2
3// Replace with an existing Group Census Member Id
4String memberId = '0r6xx00000007BrAAI';
5
6// Optional: include dependents’ plans (requires API version >= 258)
7Boolean includeDependents = true;
8
9try {
10    ConnectApi.InsuranceGetMembersPlans result =
11        ConnectApi.InsuranceGroupBenefitsFamily.getInsuranceMemberEligiblePlans(memberId, includeDependents);
12
13    System.debug('Eligible Plans response: ' + JSON.serializePretty(result));
14} catch (Exception e) {
15    System.debug('Error while fetching eligible plans: ' + e.getMessage());
16}