You are here:
InsCensusService:addPlanSelections
Use this service to insert pre-enrolled plans for each member specified in the input.
Method: addPlanSelections
How It Works
-
The
ContractLineId__cnode contains theContractLineItem__cIds that the member is pre-enrolled in. -
For each of
ContractLineItem__cId, the service evaluates whether the plan is valid for the member as follows:-
The
contractIdis valid for thecensusId; -
The
ContractLineItem__cId is valid for thecontractId; -
The product type of the
ContractLineItem__cfor the primary member isn’t equal to the product types listed in the primary member'sOptOutTypes__c; -
The product type of the
ContractLineItem__cfor a dependent isn’t equal to the product types listed in the dependent'sOptOutTypes__c, and the product type of theContractLineItem__cisn’t be equal to the product types listed in the dependent's primary member'sOptOutTypes__c.
-
-
The Ids of successfully created
GroupCensusMemberPlan__centries are returned. -
The service also deletes newly created members (
isNewMemberis set to true in the JSON object) that don’t have entries inGroupCensusMemberPlan__cand whenonlySaveMembersWithValidProductsis set to true.
Remote Options
Option |
Description |
|---|---|
|
Required. Id of census with the members whose plans must be inserted. Validates that the contractId belongs to the account/census. |
|
Required. Id of Account's current contract. Validates that the plans for each member are part of the contract. |
|
Required. JSON object with two nodes:
|
|
Optional. If true, new members without entries
in |
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"
}
]
}

