Loading
Prepare for Email to Become the Default Login ExperienceRead More
The online Trailblazer Community becomes read-only Oct 30, 2026Read More
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More
Insurance
InsCensusService:addPlanSelections

InsCensusService:addPlanSelections

Use this service to insert pre-enrolled plans for each member specified in the input.

Important
Important From Winter '23 onward, we have InsCensusServiceStd:addPlanSelections service enabled to work with Salesforce Standard Data Model for Financial Services Cloud and Health Cloud. Existing customers can continue to use this service, but no further enhancements will be provided in the Insurance Managed Package.

Class: InsCensusService

Method: addPlanSelections

How It Works

  • The ContractLineId__c node contains the ContractLineItem__c Ids that the member is pre-enrolled in.

  • For each of ContractLineItem__c Id, the service evaluates whether the plan is valid for the member as follows:

    • The contractId is valid for the censusId;

    • The ContractLineItem__c Id is valid for the contractId;

    • The product type of the ContractLineItem__c for the primary member isn’t equal to the product types listed in the primary member's OptOutTypes__c;

    • The product type of the ContractLineItem__c for a dependent isn’t equal to the product types listed in the dependent's OptOutTypes__c, and the product type of the ContractLineItem__c isn’t be equal to the product types listed in the dependent's primary member's OptOutTypes__c.

  • The Ids of successfully created GroupCensusMemberPlan__c entries are returned.

  • The service also deletes newly created members (isNewMember is set to true in the JSON object) that don’t have entries in GroupCensusMemberPlan__c and when onlySaveMembersWithValidProducts is set to true.

Remote Options

Option

Description

censusId

Required.

Id of census with the members whose plans must be inserted.

Validates that the contractId belongs to the account/census.

contractId

Required.

Id of Account's current contract.

Validates that the plans for each member are part of the contract.

census

Required.

JSON object with two nodes:

  • headers— The API name of contract line Id (ContractLineId__c).

  • members—List of members with plans to be inserted or updated. It must include the following two nodes:

    • Id — The census member Id (GroupCensusMember__c.Id).

    • ContractLineId__c — The list of the plans (ContractLineItem__c.Id) that the member is pre-enrolled in. The contract line items are delimited by semicolon(;).

onlySaveMembersWithValidProducts

Optional.

If true, new members without entries in GroupCensusMemberPlan__c are deleted. The default value is false.

Input JSON

Here's the format of the input JSON:

{  
   "censusId":"ID",
   "contractId":"ID",
   "onlySaveMembersWithValidProducts":true,
   "census":{  
      "headers":[  
         {  
            "name":"vlocity_ins__ContractLineId__c"
         },
      ],
      "members":[  
         {  
            "Id":"Census Member ID",
            "isNewMember":true,
            "vlocity_ins__ContractLineId__c": "ContractLineItem__c.Id;ContractLineItem__c.Id"
            
         },
         {  
            "Id":"Census Member ID",
            "isNewMember":true,
            "vlocity_ins__ContractLineId__c": "ContractLineItem__c.Id;ContractLineItem__c.Id"
         }
      ]
   },
}

Here's an example of the input JSON:

{  
   "censusId":"a4D4P000000hbjSUAQ",
   "contractId":"8004P000000zF2dQAE",
   "census":{  
      "members":[  
         {  
            "vlocity_ins__ContractLineId__c": "a4D4P000000hbjSUAQ;a4D4P000000hbjSUAQ",
            "Id":"a4C4P000000d7POUAY"
         }
      ],
      "headers":[  
         {  
            "name":"vlocity_ins__ContractLineId__c"
         }
      ]
   }
}

Output JSON

The service returns the list of successfully inserted GroupCensusMemberPlan__c Ids. It also provides the list of errors encountered. These errors are grouped per member.

Here's the format of the output JSON:

{  
   "memberPlanIds":[  
      "GroupCensusMemberPlan__c.Id"
   ],
   "errors":[  
      {  
         "error":"error"
      }
   ]
}

The service returns an output JSON, formatted as per the following sample:

{  
   "memberPlanIds":[  
      "a4B4P000006jKsMUAU",
      "a4B4P000006jKsNUAU",
      "a4B4P000006jKsOUAU",
      "a4B4P000006jKsPUAU"
   ],
   "errors":[  
      {  
         "numPlansError":2,
         "error":"ContractLineItem__c value is not valid:8004P000000zJKjQAM; Medical",
         "numPlans":2,
         "Id":"a4C4P000000ed6dUAA",
         "isNewMember":true,
         "vlocity_ins__ContractLineId__c":"8004P000000zJKjQAM;Medical"
      }
   ]
}
 
Loading
Salesforce Help | Article