postInsuranceDeleteMemberPlans(insuranceDeleteMemberPlansInputRepresentation, memberId)

Delete the specified plans for a group census member.

API Version

65.0

Requires Chatter

No

Signature

public static ConnectApi.InsuranceDeleteMemberPlansOutputRepresentation postInsuranceDeleteMemberPlans(ConnectApi.InsuranceDeleteMemberPlansInputRepresentation insuranceDeleteMemberPlansInputRepresentation, String memberId)

Parameters

insuranceDeleteMemberPlansInputRepresentation
Type: ConnectApi.InsuranceDeleteMemberPlansInputRepresentation
The input representation containing the list of plans to delete.
memberId
Type: String
ID of the group census member whose plans are being deleted.

Example

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

1// Delete Member Plan(s) for a Group Census Member via Connect API (simple version)
2
3// 1) Create the top-level input
4ConnectApi.InsuranceDeleteMemberPlansInputRepresentation input = new ConnectApi.InsuranceDeleteMemberPlansInputRepresentation();
5// 2) Provide the list of existing Group Census Member Plan record Ids to delete
6//    Uses a simple string list wrapper
7List<String> planIdsToDelete = new List<String>{
8    '0rgxx000000003LAAQ',
9    '0rgxx000000003UAAQ'
10};
11input.plans = planIdsToDelete;
12// 3) Execute the POST Delete Member Plans API
13//  URL param is the Group Census Member Id whose plans you want to delete
14String memberId = '0r6xx00000004LGAAY';
15try {
16    ConnectApi.InsuranceDeleteMemberPlansOutputRepresentation result =
17        ConnectApi.InsuranceGroupBenefitsFamily.postInsuranceDeleteMemberPlans(input, memberId);
18    System.debug('Delete Member Plans result: ' + JSON.serializePretty(result));
19} catch (Exception e) {
20    System.debug('Error while deleting member plans: ' + e.getMessage());
21}