patchInsuranceUpdateMemberPlans(insuranceUpdateMemberPlansInput, memberId)

Update the plans that are associated with a group census member.

API Version

65.0

Requires Chatter

No

Signature

public static ConnectApi.InsuranceUpdateMemberPlansOutputRepresentation patchInsuranceUpdateMemberPlans(ConnectApi.InsuranceUpdateMemberPlansInputRepresentation insuranceUpdateMemberPlansInput, String memberId)

Parameters

insuranceUpdateMemberPlansInput
Type: ConnectApi.InsuranceUpdateMemberPlansInputRepresentation
Details to update the insurance plans for the census member.
memberId
Type: String
ID of the group census member whose plans must be updated.

Example

Here's an example of how to invoke the Insurance Update Member Plans API from Apex code.

1// Update Member Plan(s) for a Group Census Member via Connect API (simple version)
2
3// 1) Create the top-level input
4ConnectApi.InsuranceUpdateMemberPlansInputRepresentation input = new ConnectApi.InsuranceUpdateMemberPlansInputRepresentation();
5
6// 2) Plans to ADD (provide Contract Group Plan Ids to add)
7List<ConnectApi.GroupCensusMemberPlanInputRepresentation> added = new List<ConnectApi.GroupCensusMemberPlanInputRepresentation>();
8
9ConnectApi.GroupCensusMemberPlanInputRepresentation addPlan1 = new ConnectApi.GroupCensusMemberPlanInputRepresentation();
10addPlan1.contractGroupPlanId = '0rgxx000000003UAAQ'; // e.g., a2Cxx0000001234AAA
11added.add(addPlan1);
12
13// Assign added plans
14input.addedPlans = added;
15
16// 3) Plans to DELETE (provide existing Group Census Member Plan record Ids)
17input.deletedPlans = new List<String>{
18    // 'REPLACE_WITH_MEMBER_PLAN_ID_1',
19    // 'REPLACE_WITH_MEMBER_PLAN_ID_2'
20};
21
22// 4) Execute the PATCH API with the Group Census Member Id
23String memberId = '0r6xx00000004LGAAY';
24
25try {
26    ConnectApi.InsuranceUpdateMemberPlansOutputRepresentation result =
27        ConnectApi.InsuranceGroupBenefitsFamily.patchInsuranceUpdateMemberPlans(input, memberId);
28
29    System.debug('Update Member Plans result: ' + JSON.serializePretty(result));
30} catch (Exception e) {
31    System.debug('Error while updating member plans: ' + e.getMessage());
32}