You are here:
InsCensusServiceStd:updateMembers
Use this service to update the values of existing members in a census.
Class: InsCensusServiceStd
Method: updateMembers
How It Works
-
This service takes the members from an input JSON and updates the census (as per the given
censusId) with the new data. -
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). -
membersis the list of members to be updated in the census.
-
-
The service looks for
updateByIdfield. It's a boolean field that decides the course of action for the service. The members can be updated in these two ways:-
updateMembersbyMemberKeyThis option is applicable when
updateByIdis false. The members data must have a member key. -
updateMembersby Id ofGroupCensusMemberThis option is applicable when
updateByIdis true. The members data must have a group census member Id.
-
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 given
GroupClass.Nameis invalid, an error is returned. The service takes a new parameterquoteEffectiveDateto validateGroupClass. TheGroupClassis considered valid if:-
GroupClassis linked to member's group account. -
quoteEffectiveDatelies betweenGroupClassStartDateandEndDate. IfquoteEffectiveDateis not provided as a parameter to the service, then this validation is skipped.
-
- 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.
updateMembers by Id
-
The service parses the members' data with the fields provided in
headers.headersmust contain all the fields' metadata used in the members list. -
membersdata must have Id. If the Id is not found in member data, then the service throws an error. -
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 service has
-
The service processes
PrimaryGroupCensusMemberIdfor dependents withPrimaryMemberSource.- If you provide
PrimaryMemberSource, then the service also updatesPrimaryGroupCensusMemberId.
- If you provide
-
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 members including dependents.
-
The service doesn't identify orphan 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. |
|
Required. Input JSON with details for members to be updated. |
updateById
|
Optional If set true, then service follows The default value is false. |
Service Behavior
Understand how different inputs affect the service outputs.
| Input | updateById | Service Output |
|---|---|---|
No censusId |
true or false | The service returns an error: |
| No census input JSON | true or false | The service returns an error: The census input is missing. |
The value of PrimaryMemberSource provided to primary member |
false | The service returns an error: The PrimaryMemberSource must be null for primary members. |
headers is missing in Input census |
true or false | The service returns an error: The header node is missing in the census input. |
members is missing in Input census |
true or false | The service returns an error: The members node is missing in the census input. |
| For orphan dependents (The dependents with no PrimaryMemberSource or PrimaryGroupCensusMemberId) | false | The service returns an error: Dependent has no primary member. |
| Id is missing in members' data | true | The service returns an error: Specify Id of the census member. |
Input JSON
The input JSON includes headers, which lists the fields to be updated; and members, which lists members with their corresponding field-value pairs, including fieldId.
Sample Input JSON (updateMembers By MemberKey)
{
"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": [
{
"MemberKey": "cd64a62573825ee11b87ce91110aa576",
"Lastname": "KoffinsUpdated",
"FirstName": "RajUpdated",
"FullTimeEquivalent": 1,
"Gender": "Male",
"Birthdate": "1965-10-13",
"SourceSystemIdentifier": "1.primary",
"PrimaryMemberSource": null,
"Email": "testrajUpdated@mail.com"
},
{
"MemberKey": "f2f8735bbb66b3f7d7b2bae794c00650",
"Lastname": "Koffins",
"FirstName": "KrisUpdated",
"Gender": "Male",
"Birthdate": "2010-05-13",
"RelationshipToPrimaryMember": "Child",
"SourceSystemIdentifier": "1.child",
"PrimaryMemberSource": "1.primary",
"Email": "testkrisUpdated@mail.com"
},
{
"Lastname": "WarnerUpdated",
"MemberKey": "5a5bc4e3c05cf461a65a2d7fdc0ab8e0",
"FirstName": "Christopher",
"FullTimeEquivalent": 0.75,
"Gender": "Male",
"Birthdate": "1985-10-13",
"SourceSystemIdentifier": "2.primary",
"PrimaryMemberSource": null,
"Email": "testchristopherUpdated@mail.com"
},
{
"Lastname": "WarnerUpdated",
"MemberKey": "157b2052fc732d8261984c2922a3261b",
"FirstName": "Steph",
"Gender": "Male",
"Birthdate": "1985-10-13",
"RelationshipToPrimaryMember": "Spouse",
"SourceSystemIdentifier": "2.spouse",
"PrimaryMemberSource": "2.primary",
"Email": "teststephUpdated.com"
}
]
}
}Sample Input JSON (updateMembers By Id)
{
"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": [
{
"Id":"0r6RO00000005pZYAQ",
"Lastname": "KoffinsUpdatedById",
"FirstName": "RajUpdatedById",
"Birthdate": "1965-10-13",
"Email": "testrajUpdated@mail.com"
},
{
"Id":"0r6RO00000005pbYAA",
"Lastname": "Koffins",
"FirstName": "KrisUpdatedById",
"Gender": "Male",
"Birthdate": "2010-05-13",
"RelationshipToPrimaryMember": "Child",
"Email": "testkrisUpdatedById@mail.com"
},
{
"Id":"0r6RO00000005paYAA",
"Lastname": "WarnerUpdatedById",
"FirstName": "Christopher",
"FullTimeEquivalent": 0.75,
"Gender": "Male",
"Birthdate": "1985-10-13",
"Email": "testchristopherUpdatedById@mail.com"
},
{
"Lastname": "WarnerUpdatedById",
"FirstName": "Steph",
"Birthdate": "1985-10-13",
"Email": "teststephUpdated.com"
}
]
}
}
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.
Sample Output JSON (updateMembers By MemberKey)
{
"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"
}
],
"censusMemberIds": [
"0r6RO00000005pZYAQ",
"0r6RO00000005paYAA",
"0r6RO00000005pbYAA"
],
"deletedCensusMemberIds": [],
"errorCode": "INVOKE-200",
"error": "OK"
}Sample Output JSON - (updateMembers By Id)
{
"result": "success",
"relatedFieldsUpdateErrors": [],
"relatedFieldsUpdateErrorCount": 0,
"relatedFieldsUpdateSuccessCount": 2,
"errors": [
{
"error": "Specify Id of the census member.",
"Birthdate": "1985-10-13",
"Lastname": "WarnerUpdatedById",
"FirstName": "Steph",
"Email": "teststephUpdated.com"
}
],
"censusMemberIds": [
"0r6RO00000005pZYAQ",
"0r6RO00000005pbYAA",
"0r6RO00000005paYAA"
],
"errorCode": "INVOKE-200",
"error": "OK"
}
