You are here:
InsCensusServiceStd:addMembers
Use this service to add group census members to a group census using an input JSON.
Class: InsCensusServiceStd
Method: addMembers
How It Works
The service takes the members in census input JSON and adds them to the given censusId. It returns a list of the Ids of the added members (censusMemberIds).
The service parses the member data.
Parses members' data with the fields provided in headers. Headers must contain all the fields' metadata used in the member list.
Separates primary members and dependent members based on
RelationshipToPrimaryMember. If the member list contains primary members and dependents, the input must haveSourceSystemIdentifierfor all of the members. All the members must have uniqueSourceSystemIdentifier. Additionally, all the dependents must havePrimaryMemberSourceorPrimaryGroupCensusMemberId(If the primary member is already present in the census). Generates
MemberKey.Processes new
GroupClass. IfGroupClass.Nameis given to service instead ofGroupClassId, then the service fetchesGroupClasswith the name and creates a newGroupClasswith the same name if not found. The header forGroupClass.Name is {"type":"STRING","label":"Group Class Name","fieldId":"","name":"GroupClass.Name"}. If the givenGroupClass.Nameis invalid, an error is returned. The service takes a new parameterquoteEffectiveDateto validateGroupClass. TheGroupClassis considered valid if:Note IfGroupClass.Nameis provided, then also includeAccountIdin members' data.GroupClassis linked to member's group account.quoteEffectiveDatelies betweenGroupClassStartDateandEndDate. IfquoteEffectiveDateis not given as a parameter to service, then this validation is skipped.
Processes
PrimaryMemberSourcefor dependents withPrimaryGroupCensusMemberId. If bothPrimaryMemberSourceandPrimaryGroupCensusMemberIdare provided in member data, then service consumesPrimaryGroupCensusMemberIdas source and updatesPrimaryMemberSourceof dependent to containSourceSystemIdentifierof primary.
Saves all Primary Members. The service uses
MemberKeyto identify duplicates. If there is a duplicate member, the service updates the fields of that pre-existing member. TheMemberKeymust be a unique combination of strings.Parses dependents to identify Orphan dependents (Dependents without
PrimaryMemberSource).Saves all valid dependents. The service uses
MemberKeyto identify duplicates. In there is a duplicate member record, the service updates the fields of that pre-existing member instead of creating a new record.Updates
DependentCountof all primary members in the member list.
Service Behavior
Understand how different inputs affect the service outputs.
| Input | Service Output |
|---|---|
No censusId |
The service returns an error: Specify a censusId. |
| No census input JSON | The service returns an error: The census input is missing. |
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. |
Remote Options
Option |
Description |
|---|---|
|
Required. Id of the group census to add members to. |
|
Required. Input JSON of the members to be added. census JSON consists of two lists - headers and members. headers is the list of fields' metadata comprising of fieldId, type, label, and name. Here name is field's API Name (with namespace for managed package and custom fields). members is the list of members to be added to the census. |
duplicateKey
|
Optional. List of fields to generate |
Input JSON
The input JSON consists of two lists - headers and members. headers is the list of fields' metadata comprising of fieldId, type, label, and name. Here name is field's API Name (with namespace for managed package and custom fields). members is the list of members to be added to the census.
{
"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"
}
],
"members": [
{
"Lastname": "Koffins",
"FirstName": "Raj",
"FullTimeEquivalent": 1,
"Gender": "Male",
"Birthdate": "1985-10-13",
"SourceSystemIdentifier": "1.primary",
"PrimaryMemberSource": null,
"Email": "testraj@mail.com",
"AccountId":"001B000001QOqJHIA1",
"IsOptOutAllPlans":true,
"OptOutPlanTypes":"Medical;Dental"
},
{
"Lastname": "Koffins",
"FirstName": "Rita",
"Gender": "Female",
"Birthdate": "1987-07-13",
"RelationshipToPrimaryMember": "Spouse",
"SourceSystemIdentifier": "1.spouse",
"PrimaryMemberSource": null,
"Email": "testrita@mail.com",
"AccountId":"001B000001QOqJHIA1",
"IsOptOutAllPlans":true,
"OptOutPlanTypes":"Medical;Dental"
},
{
"Lastname": "Koffins",
"FirstName": "Kris",
"Gender": "Male",
"Birthdate": "2016-05-13",
"RelationshipToPrimaryMember": "Child",
"SourceSystemIdentifier": "1.child",
"PrimaryMemberSource": "1.primary",
"Email": "testkris@mail.com",
"AccountId":"001B000001QOqJHIA1",
"IsOptOutAllPlans":true,
"OptOutPlanTypes":"Medical;Dental"
},
{
"Lastname": "Warner",
"FirstName": "Christopher",
"FullTimeEquivalent": 0.5,
"Gender": "Male",
"Birthdate": "1985-10-13",
"SourceSystemIdentifier": "2.primary",
"PrimaryMemberSource": null,
"Email": "testchristopher@mail.com",
"AccountId":"001B000001QOqJHIA1",
"IsOptOutAllPlans":false,
"OptOutPlanTypes":"Medical"
},
{
"Lastname": "Warner",
"FirstName": "Steph",
"Gender": "Male",
"Birthdate": "1985-10-13",
"RelationshipToPrimaryMember": "Spouse",
"SourceSystemIdentifier": "2.spouse",
"PrimaryMemberSource": "2.primary",
"Email": "teststeph@mail.com",
"AccountId":"001B000001QOqJHIA1",
"IsOptOutAllPlans":false,
"OptOutPlanTypes":"Medical"
},
{
"Lastname": "Jose",
"FirstName": "Steve",
"Gender": "Male",
"Birthdate": "1989-10-13",
"FullTimeEquivalent":10,
"SourceSystemIdentifier": "3.primary",
"Email": "teststeve@mail.com",
"AccountId":"001B000001QOqJHIA1",
"IsOptOutAllPlans":false,
"OptOutPlanTypes":"Medical"
}
]
}
}
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 theDependentCountupdate returns errors. -
relatedFieldsUpdateErrors: The list of errors returned while updatingDependentCountof primary members.
{
"result": "success",
"relatedFieldsUpdateErrors": [],
"relatedFieldsUpdateErrorCount": 0,
"relatedFieldsUpdateSuccessCount": 2,
"errors": [
{
"error": "[FullTimeEquivalent]: NUMBER_OUTSIDE_VALID_RANGE - Full Time Equivalent: value outside of valid range on numeric field: 10",
"Birthdate": "1989-10-13",
"Gender": "Male",
"IsOptOutAllPlans": false,
"Lastname": "Jose",
"SourceSystemIdentifier": "3.primary",
"FullTimeEquivalent": 10,
"FirstName": "Steve",
"AccountId": "001B000001QOqJHIA1",
"Email": "teststeve@mail.com",
"OptOutPlanTypes": "Medical"
},
{
"RelationshipToPrimaryMember": "Spouse",
"SourceSystemIdentifier": "1.spouse",
"OptOutPlanTypes": "Medical;Dental",
"PrimaryMemberSource": null,
"error": "Dependent has no primary member.",
"Birthdate": "1987-07-13",
"Gender": "Female",
"IsOptOutAllPlans": true,
"Lastname": "Koffins",
"FirstName": "Rita",
"AccountId": "001B000001QOqJHIA1",
"Email": "testrita@mail.com"
}
],
"censusMemberIds": [
"0r6B00000000ANcIAM",
"0r6B00000000ANdIAM",
"0r6B00000000ANeIAM",
"0r6B00000000ANfIAM"
],
"errorCode": "INVOKE-200",
"error": "OK"
}
