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.
Return Value
Type: ConnectApi.InsuranceUpdateMemberPlansOutputRepresentation
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()); }