---
schema_version: "1"
id: cdade9e6aef7ded649367aa550afc6b358f5ac9a4f57980bdfe1365cd01d5226
title: patchInsuranceUpdateMemberPlans(insuranceUpdateMemberPlansInput, memberId)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/insurance_developer_guide/apex_ConnectAPI_InsuranceGroupBenefitsFamily_patchInsuranceUpdateMemberPlans.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_ConnectAPI_InsuranceGroupBenefitsFamily_patchInsuranceUpdateMemberPlans.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7253fe69d3019f59fc41232a3dc36ac0bd9bf1977eb12bb08a8c5777b964fa92
description: Update the plans that are associated with a group census member.
---
# 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](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_input_insurance_update_member_plans.htm "Input representation for updating the plans for a group census member.")
- Details to update the insurance plans for the census member.

**memberId**

- Type: String
- ID of the group census member whose plans must be updated.

## Return Value

Type: [ConnectApi.InsuranceUpdateMemberPlansOutputRepresentation](https://developer.salesforce.com/docs/atlas.en-us.insurance_developer_guide.meta/insurance_developer_guide/apex_connectapi_output_insurance_update_member_plans.htm "Output representation for the member plan update process.")

## 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());
}