How can I update double nested attributes using POST /entities?partialOverride?

Question

We have a nested attribute called IndividualEnrollments and under that there is another nested attribute called IndividualEnrollmentsCustomFields. I have configured the match uri to be the type, configured them as the type+value and as the value and in each time I am getting the same result.

The problem is that when an enrollment is created with a custom field with type a, value b. and then I send another request to add another custom field with type c and value d. It is overwriting, instead of the enrollment having two custom fields of type a and c. It only has one of type c.

Screenshot 2023-05-03 at 8.05.01 PM.png

Screenshot 2023-05-03 at 8.16.26 PM.png

Update API

GET https://<environment>.reltio.com/reltio/api/<tenantId>/entities?options=partialOverride,updateAttributeUpdateDatesOnActualChanges,ovOnly

Request Payload

[
{
"type": "configuration/entityTypes/Individual",
"crosswalks": [
{
"value": "PGRWCS_07431747678",
"updateDate": "2023-05-03T11:58:58.317830z",
"sourceTable": "PetcoEcom_Individual",
"type": "configuration/sources/PetcoEcom",
"dataProvider": true
}
],
"attributes": {
"IndividualEnrollments": [
{
"value": {
"EnrollmentID": [
{
"value": 2386969
}
],
"Type": [
{
"value": "Food_Club"
}
],
"Status": [
{
"value": "Active"
}
],
"IndividualEnrollmentsCustomFields": [
{
"value": {
"Type": [
{
"value": "policy_id"
}
],
"Value": [
{
"value": "1234"
}
]
}
}
]
}
}
]
}
}
]

Answer

  • Change  L3 configuration Survivorship definition because the IndividualEnrollmentsCustomFields values will become winners. ("ov"=true) 
                       {
                         "attribute": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/IndividualEnrollmentsCustomFields",
                         "survivorshipStrategy": "Aggregation"
                     },
                     {
                         "attribute": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/IndividualEnrollmentsCustomFields/attributes/Type",
                         "survivorshipStrategy": "Aggregation"
                     },
                     {
                         "attribute": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/IndividualEnrollmentsCustomFields/attributes/Value",
                         "survivorshipStrategy": "Aggregation"
                     }
  • Change needed for L3 configuration for both IndividualEnrollments andIndividualEnrollmentsCustomField.
  • This action is taken because if you include both keyAttributeURIs and matchFieldURIs in the L3 and you have data defined in the keyAttribute in your POST /entities?partial override payload, values will also was be replace and NOT inserted.
  • Alternatively, you could keep keyAttributeURIs and matchFieldURIs in the L3, but then you should NOT include both values in POST /entities?partialOverride payload.
 {

                    "label": "Individual Enrollments",
                    "name": "IndividualEnrollments",
                    "description": "Individual Enrollments",
                   "type": "Nested",
                   "hidden": false,
                   "important": false,
                   "system": false,
                   "faceted": true,
                   "searchable": true,
                   "attributeOrdering": {
                       "orderType": "ASC",
                       "orderingStrategy": "LUD"
                   },
                   "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments",
                   "dataLabelPattern": "{EnrollmentID}, {Type}, {Status}",
                   "matchFieldURIs": [
                       "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/EnrollmentID",
                       "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/Type"
                   ],
                   "matchOvOnly": true,
                   "attributes": [
                       {
                           "label": "Enrollment ID",
                           "name": "EnrollmentID",
                           "type": "String",
                           "hidden": false,
                          "important": false,
                           "system": false,
                           "searchable": true,
                           "autoGenerated": true,
                           "generator": "EnrollmentIDSequential",
                           "autoGenerationPattern": "{value}",
                           "generateIfEmpty": true,
                           "generateIfNotEmpty": false,
                           "generatedValueUniqueForCrosswalk": false,
                           "attributeOrdering": {
                               "orderingStrategy": "LUD"
                           },
                           "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/EnrollmentID",
                           "skipInDataAccess": false
                       },
                       {
                           "label": "Type",
                           "name": "Type",
                           "description": "Type",
                           "type": "String",
                           "hidden": false,
                           "important": false,
                           "system": false,
                           "faceted": true,
                          "searchable": true,
                          "attributeOrdering": {
                              "orderingStrategy": "LUD"
                          },
                           "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/Type",
                           "lookupCode": "rdm/lookupTypes/ENROLLMENTTYPE",
                           "skipInDataAccess": false
                       },
                       {
                           "label": "Status",
                           "name": "Status",
                           "description": "Status",
                           "type": "String",
                           "hidden": false,
                           "important": false,
                           "system": false,
                           "faceted": true,
                           "searchable": true,
                           "attributeOrdering": {
                               "orderingStrategy": "LUD"
                           },
                           "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/Status",
                           "lookupCode": "rdm/lookupTypes/ENROLLMENTSTATUS",
                           "skipInDataAccess": false
                       },
                       {
                           "label": "Status Change Date",
                           "name": "StatusChangeDate",
                           "description": "Status Change Date",
                           "type": "Date",
                           "hidden": false,
                           "important": false,
                           "system": false,
                           "faceted": true,
                           "searchable": true,
                           "attributeOrdering": {
                               "orderingStrategy": "LUD"
                           },
                           "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/StatusChangeDate",
                           "skipInDataAccess": false
                       },
                       {
                           "label": "Start Date",
                           "name": "StartDate",
                           "description": "Start Date",
                           "type": "Date",
                           "hidden": false,
                           "important": false,
                           "system": false,
                           "faceted": true,
                           "searchable": true,
                           "attributeOrdering": {
                               "orderingStrategy": "LUD"
                           },
                           "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/StartDate",
                           "skipInDataAccess": false
                       },
                       {
                           "label": "Individual Enrollments Custom Fields",
                           "name": "IndividualEnrollmentsCustomFields",
                           "type": "Nested",
                           "hidden": false,
                           "important": false,
                           "system": false,
                           "attributeOrdering": {
                               "fieldURI": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/IndividualEnrollmentsCustomFields/attributes/Type",
                               "orderType": "ASC",
                               "orderingStrategy": "FieldBased"
                           },
                           "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/IndividualEnrollmentsCustomFields",
                           "dataLabelPattern": "{Type} {Value}",
                           "matchFieldURIs": [
                               "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/IndividualEnrollmentsCustomFields/attributes/Type"
                           ],
                           "attributes": [
                               {
                                   "label": "Type",
                                   "name": "Type",
                                   "description": "",
                                   "type": "String",
                                   "hidden": false,
                                   "important": false,
                                   "system": false,
                                   "faceted": true,
                                   "searchable": true,
                                   "attributeOrdering": {
                                       "orderingStrategy": "LUD"
                                   },
                                   "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/IndividualEnrollmentsCustomFields/attributes/Type",
                                   "lookupCode": "rdm/lookupTypes/ENROLLMENTCUSTOMFIELDTYPES",
                                   "skipInDataAccess": false
                               },
                               {
                                   "label": "Value",
                                   "name": "Value",
                                   "description": "",
                                   "type": "String",
                                   "hidden": false,
                                   "important": false,
                                   "system": false,
                                   "searchable": true,
                                   "attributeOrdering": {
                                       "orderingStrategy": "LUD"
                                   },
                                   "uri": "configuration/entityTypes/Individual/attributes/IndividualEnrollments/attributes/IndividualEnrollmentsCustomFields/attributes/Value",
                                   "skipInDataAccess": false
                               }
                          ],
                           "skipInDataAccess": false
                       }
                   ],
                   "skipInDataAccess": false
               },

 
The specifics of keyAttributeURIs and matchFieldURIs 

  • If keyAttributeURIs is set in L3, the system looks for required Nested attribute using keyAttributeURIs.
    • If it is found: the sub-attributes of the nested attribute can be changed, removed or added, which creates DELETE_ATTRIBUTE + INSERT_ATTRIBUTE, DELETE_ATTRIBUTE and INSERT_ATTRIBUTE changes in DCR accordingly. The system then searches among the other nested attribute values for a match by the set of attributes, specified in matchFieldURIs. If it is found, the values are merged, and the DELETE_ATTRIBUTE change is generated for one of the merged values.
    • If it is not found: a new value is added to the nested attribute. The INSERT_ATTRIBUTE change is generated.
    • If it is not set in a request: a new value is inserted to the nested attribute. The INSERT_ATTRIBUTE change is generated.
  • If only matchFieldURIs is set in L3: the system tries to find matches with other values of the nested attribute inside the entity. If it is found, the values are merged, and the INSERT_ATTRIBUTE change for sub-attributes different from the existing ones is generated.
  • If both keyAttributeURIs and matchFieldURIs are not set in L3: a new value is inserted to the nested attribute and the INSERT_ATTRIBUTE change is generated. In this case, inheritance should be considered.
  •  Change needed for the physical tenant storage.
 "enableNestedPartialOverride": true,
"enableReferencePartialOverride": true,

Reference. 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.