You are here:
InsCensusServiceStd:updateMembersWithPlans
Use this service to populate a group census with primary members, their dependents, and their pre-enrolled plan. This service updates existing GroupCensusMember by memberKey and creates GroupCensusMemberPlan records for existing GroupCensusMember records. It uses the ContractGroupPlans specified in the input JSON to update plans for each GroupCensusMember.
Class: InsCensusServiceStd
Method: updateMembersWithPlans
How It Works
-
The service passes censusId and census input JSON to update members with plans.
-
census JSON consists of two lists -
headersandmembers.-
headersis the list of fields' metadata comprising offieldId,type,labelandname. Here name is the field's API Name (with the namespace for managed package and custom fields). Theheadersmust containContactGroupPlanId. -
membersis the list of members to be updated in the census. Themembersmust containContactGroupPlanIdseparated by semicolon(;) for multiple plans.
-
-
The service calls
updateMembersby MemberKey to save data about the members, parsing through the members in the JSON object. -
The service adds
isNewMemberas true for all new members. It also populates Id for each GroupCensusMember. -
The service then calls
InsCensusServiceStd: addPlanSelectionsto createGroupCensusMemberPlanfor each member. It also accepts optional coverages per member so that primary members and dependents are enrolled into different coverages under the same plan.
updateMembers by MemberKey
-
The service parses the members' data with the fields provided in
headers.headersmust contain all the fields' metadata used in the members' list. -
The service separates primary members and dependent members based on
RelationshipToPrimaryMember.-
If the members list contains primary members and dependents, the input must have
SourceSystemIdentifierfor all of the members. All the members must have a uniqueSourceSystemIdentifier. Additionally, all the dependents must havePrimaryMemberSourceorPrimaryGroupCensusMemberId(If the primary member is already present in the census). -
If the list is a combination of primary and dependent members, then ensure every dependent member and primary member exists in members' list.
-
-
The service processes new
GroupClass. If the service hasGroupClass.Nameinstead ofGroupClassId, then it fetchesGroupClasswith the name and creates a newGroupClasswith the same name if not found.- If the service has
GroupClass.Name, then also includeAccountIdin the members' data. -
headerforGroupClass.Name:{"type":"STRING","label":"Group Class Name","fieldId":"","name":"GroupClass.Name"}. -
If the provided
GroupClassis invalid, an error is returned. TheGroupClassis considered valid if:-
GroupClassis linked to member's group account. -
The contract's effective period is between
StartDateandEndDateofGroupClass. -
The contract's
StartDateandEndDateis fetched usingContractIdprovided as an input to service
-
- If the service has
-
The services processes
PrimaryMemberSourcefor dependents withPrimaryGroupCensusMemberId.-
If the service has both
PrimaryMemberSourceandPrimaryGroupCensusMemberId, then service considersPrimaryGroupCensusMemberIdas source and updatesPrimaryMemberSourceof dependent to containSourceSystemIdentifierof primary.
-
-
The service saves all Primary Members first.
-
It parses dependents to identify orphan dependents (Dependents without
PrimaryMemberSource). -
It saves all valid dependents.
-
The service updates
DependentCountof all primary members in the members' list.
Remote Options
Option |
Description |
|---|---|
|
Required Id of the census with members to update. Validates that the |
|
Required. Input JSON with details for members to be updated. |
|
Required Id of Account's current contract. Validates that the plans of each member is part of the contract. |
|
Boolean If true, new members without entries in |
|
Optional List of fields for Default fields in the list: |
| Input | Service Output |
|---|---|
No censusId |
The service returns an error: Specify a censusId. |
No census input JSON |
The service returns an error: |
PrimaryMemberSource value provided to primary member |
The service returns an error: The PrimaryMemberSource must be null for primary members. |
headers is missing in Input census |
The service returns an error: The header node is missing in the census input. |
members is missing in Input census |
The service returns an error: The members node is missing in the census input. |
For Orphan dependents (The dependents without PrimaryMemberSource or PrimaryGroupCensusMemberId) |
The service returns an error: Dependent has no primary member. |
No contractId or invalid contractId |
The service updates no member plan. |
Invalid ContractGroupPlanId for the contract specified |
The service creates no member plan. If
|
Invalid ContractGroupPlanId for the member (due to opt-out) |
Member plan is not created If
|
| The primary member opts out of a product type |
If the primary member opts out of a product type, the dependents also opt out of that product type. |
| Dependent member opts out of a product type |
If the primary member opts out of a product type, the dependents also opt out of that product type. If |
Input JSON
Here's what the format looks like for the input JSON:
{
"census": {
"headers": [
{
"type": "STRING",
"label": "Last Name",
"fieldId": "",
"name": "Lastname"
},
{
"type": "STRING",
"label": "First Name",
"fieldId": "",
"name": "FirstName"
},
{
"type": "DOUBLE",
"label": "FTE",
"fieldId": "",
"name": "FullTimeEquivalent"
},
{
"type": "PICKLIST",
"label": "Gender",
"fieldId": "",
"name": "Gender"
},
{
"type": "DATE",
"label": "Birthday",
"fieldId": "",
"name": "Birthdate"
},
{
"type": "PICKLIST",
"label": "Relationship To Primary",
"fieldId": "",
"name": "RelationshipToPrimaryMember"
},
{
"type": "BOOLEAN",
"label": "Is Opt-out All Plans",
"fieldId": "",
"name": "IsOptOutAllPlans"
},
{
"type": "MULTIPICKLIST",
"label": "Opt-Out Plan Types",
"fieldId": "",
"name": "OptOutPlanTypes"
},
{
"type": "ENTITYID",
"label": "Account",
"fieldId": "",
"name": "AccountId"
},
{
"type": "EMAIL",
"label": "Email",
"fieldId": "",
"name": "Email"
},
{
"type": "STRING",
"label": "Primary Member Identifier",
"fieldId": "",
"name": "PrimaryMemberSource"
},
{
"type": "STRING",
"label": "Member Identifier",
"fieldId": "",
"name": "SourceSystemIdentifier"
},
{
"type": "ENTITYID",
"label": "Contract Group Plan",
"fieldId": "",
"name": "ContractGroupPlanId"
}
],
"members": [
{
"MemberKey": "cd64a62573825ee11b87ce91110aa576",
"Lastname": "KoffinsUpdated",
"FirstName": "RajUpdated",
"FullTimeEquivalent": 1,
"Gender": "Male",
"Birthdate": "1965-10-13",
"SourceSystemIdentifier": "1.primary",
"PrimaryMemberSource": null,
"Email": "testrajUpdated@mail.com",
"ContractGroupPlanId":"a4D4P000000hbjSUAQ;a4D4P000000hbjSUAQ"
},
{
"MemberKey": "f2f8735bbb66b3f7d7b2bae794c00650",
"Lastname": "Koffins",
"FirstName": "KrisUpdated",
"Gender": "Male",
"Birthdate": "2010-05-13",
"RelationshipToPrimaryMember": "Child",
"SourceSystemIdentifier": "1.child",
"PrimaryMemberSource": "1.primary",
"Email": "testkrisUpdated@mail.com",
"ContractGroupPlanId":"a4D4P000000hbjSUAQ;a4D4P000000hbjSUAQ"
},
{
"Lastname": "WarnerUpdated",
"MemberKey": "5a5bc4e3c05cf461a65a2d7fdc0ab8e0",
"FirstName": "Christopher",
"FullTimeEquivalent": 0.75,
"Gender": "Male",
"Birthdate": "1985-10-13",
"SourceSystemIdentifier": "2.primary",
"PrimaryMemberSource": null,
"Email": "testchristopherUpdated@mail.com",
"ContractGroupPlanId":"a4D4P000000hbjSUAQ;a4D4P000000hbjSUAQ"
},
{
"Lastname": "WarnerUpdated",
"MemberKey": "157b2052fc732d8261984c2922a3261b",
"FirstName": "Steph",
"Gender": "Male",
"Birthdate": "1985-10-13",
"RelationshipToPrimaryMember": "Spouse",
"SourceSystemIdentifier": "2.spouse",
"PrimaryMemberSource": "2.primary",
"Email": "teststephUpdated.com",
"ContractGroupPlanId":"a4D4P000000hbjSUAQ;a4D4P000000hbjSUAQ"
}
]
}
}Output JSON
The service returns success message if the flow is completed, else it returns the error in case of any exceptions.
-
censusMemberIds: The list ofGroupCensusMemberIdsof saved members. -
errors: The list of members with errors. Each list item consists of input member data and error.
-
relatedFieldsUpdateSuccessCount: Number of primary members for whom theDependentCountis updated by service. -
relatedFieldsUpdateErrorCount: Number of primary members for whom theDependentCountupdation returns errors. -
relatedFieldsUpdateErrors: The list of errors returned while updatingDependentCountof primary members. -
memberPlanIds: The list of successfully insertedGroupCensusMemberPlanIds.
{
"result": "success",
"relatedFieldsUpdateErrors": [],
"relatedFieldsUpdateErrorCount": 0,
"relatedFieldsUpdateSuccessCount": 2,
"errors": [
{
"error": "[Email]: INVALID_EMAIL_ADDRESS - Email: invalid email address: teststephUpdated.com",
"Birthdate": "1985-10-13",
"Gender": "Male",
"Lastname": "WarnerUpdated",
"RelationshipToPrimaryMember": "Spouse",
"MemberKey": "157b2052fc732d8261984c2922a3261b",
"SourceSystemIdentifier": "2.spouse",
"FirstName": "Steph",
"Email": "teststephUpdated.com",
"PrimaryMemberSource": "2.primary",
"ContractGroupPlanId":"a4D4P000000hbjSUAQ;a4D4P000000hbjSUAQ"
}
],
"censusMemberIds": [
"0r6RO00000005pZYAQ",
"0r6RO00000005paYAA",
"0r6RO00000005pbYAA"
],
"memberPlanIds":[
"a4B4P000006jKsMUAU",
"a4B4P000006jKsNUAU",
"a4B4P000006jKsOUAU",
"a4B4P000006jKsPUAU",
"a4B4P000006jKsQUAU",
"a4B4P000006jKsRUAU"
],
"errorCode": "INVOKE-200",
"error": "OK"
}
