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

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.

// Update Member Plan(s) for a Group Census Member via Connect API (simple version)

// 1) Create the top-level input
ConnectApi.InsuranceUpdateMemberPlansInputRepresentation input = new ConnectApi.InsuranceUpdateMemberPlansInputRepresentation();

// 2) Plans to ADD (provide Contract Group Plan Ids to add)
List<ConnectApi.GroupCensusMemberPlanInputRepresentation> added = new List<ConnectApi.GroupCensusMemberPlanInputRepresentation>();

ConnectApi.GroupCensusMemberPlanInputRepresentation addPlan1 = new ConnectApi.GroupCensusMemberPlanInputRepresentation();
addPlan1.contractGroupPlanId = '0rgxx000000003UAAQ'; // e.g., a2Cxx0000001234AAA
added.add(addPlan1);

// Assign added plans
input.addedPlans = added;

// 3) Plans to DELETE (provide existing Group Census Member Plan record Ids)
input.deletedPlans = new List<String>{
    // 'REPLACE_WITH_MEMBER_PLAN_ID_1',
    // 'REPLACE_WITH_MEMBER_PLAN_ID_2'
};

// 4) Execute the PATCH API with the Group Census Member Id
String memberId = '0r6xx00000004LGAAY';

try {
    ConnectApi.InsuranceUpdateMemberPlansOutputRepresentation result =
        ConnectApi.InsuranceGroupBenefitsFamily.patchInsuranceUpdateMemberPlans(input, memberId);

    System.debug('Update Member Plans result: ' + JSON.serializePretty(result));
} catch (Exception e) {
    System.debug('Error while updating member plans: ' + e.getMessage());
}