postInsuranceGroupRenewal(censusId, insuranceGroupRenewalInputRepresentation)
API Version
68.0
Requires Chatter
No
Signature
public static ConnectApi.InsuranceGroupRenewalRepresentation postInsuranceGroupRenewal(String censusId, ConnectApi.InsuranceGroupRenewalInputRepresentation insuranceGroupRenewalInputRepresentation)
Parameters
- censusId
- Type: String
- ID of the group census whose primary members' policies must be renewed.
- insuranceGroupRenewalInputRepresentation
- Type: ConnectApi.InsuranceGroupRenewalInputRepresentation
- Optional flow and repricing settings that are used to renew member policies.
Return Value
Usage
Use this method to renew insurance policies of group census members for a contract renewal. Specify a group census whose type is Renewal in censusId. All properties on the input representation are optional.
To use a custom flow, set flowName to the flow's API name. If you omit flowName, the method uses the default RenewMemberPolicies flow. Set shouldReprice to false to keep the premiums from the existing GroupCensusMemberPlan records instead of recalculating them. The default value is true.
The method runs asynchronously. It creates insurance policies under the renewed contract for each primary census member, links the new policies to their previous policies, and records renewal transactions. Use the requestId in the response to track the job. Errors that occur while validating or scheduling the job are in the errors property.
Example
This example renews member policies for a group census whose type is Renewal. It uses the RenewMemberPolicies flow and reuses existing GroupCensusMemberPlan premiums instead of recalculating them. Provide only the input properties that you want to override.
1// Renew member policies for a contract renewal.
2// The group census type must be Renewal.
3
4final String CENSUS_ID = '0rfxx000000022IAAQ';
5final String RENEWAL_FLOW = 'RenewMemberPolicies'; // optional; default flow when omitted
6
7ConnectApi.InsuranceGroupRenewalInputRepresentation input =
8 new ConnectApi.InsuranceGroupRenewalInputRepresentation();
9input.flowName = RENEWAL_FLOW; // optional — omit to use the default RenewMemberPolicies flow
10input.shouldReprice = false; // optional — default true; false reuses existing GCMP premiums
11
12try {
13 ConnectApi.InsuranceGroupRenewalRepresentation result =
14 ConnectApi.GroupBenefitsApi.postInsuranceGroupRenewal(CENSUS_ID, input);
15
16 System.debug('requestId: ' + result.requestId);
17 System.debug('errors: ' + result.errors);
18} catch (Exception e) {
19 System.debug('Error while renewing member policies: ' + e.getMessage());
20}This example renews with the default RenewMemberPolicies flow and repricing on (shouldReprice is true). The entire input is optional in this example.
1// Renew member policies with defaults: RenewMemberPolicies flow, shouldReprice = true.
2
3final String CENSUS_ID = '0rfxx000000022IAAQ';
4
5ConnectApi.InsuranceGroupRenewalInputRepresentation input =
6 new ConnectApi.InsuranceGroupRenewalInputRepresentation();
7
8try {
9 ConnectApi.InsuranceGroupRenewalRepresentation result =
10 ConnectApi.GroupBenefitsApi.postInsuranceGroupRenewal(CENSUS_ID, input);
11
12 System.debug('requestId: ' + result.requestId);
13 System.debug('errors: ' + result.errors);
14} catch (Exception e) {
15 System.debug('Error while renewing member policies: ' + e.getMessage());
16}