Rules for Duplicate Schema Fields in Payload
This topic addresses scenarios where the payload contains duplicates, and selection is based on the child element.
If the schema fields are duplicated in the payload, the following rules apply for node selection:
- When the child node is defined as a record in the schema.
Sample schema for examples:
{ “type”: “record”, “name”: “ContactAndKids”, “fields”: [ { “name”: “MyContact”, “siebelName”: “Contact”, “type”: { “type”: “record”, “name”: “Contact”, “fields”: [ { “name”: “First_Name”, “type”: “string”, “siebelName”: “First Name” }, { “name”: “Account”, “type”: { “type”: “record”, “name”: “Account”, “fields”: [ { “name”: “Name”, “type”: “string” }, { “name”: “ID”, “type”: “string”, “siebelName”: “CSN” } ] } } ] } } ] }- The duplicates are of type record: A child node that does not have duplicate
fields is selected. If no such node exists, blank values are returned in the
output. For example:
Input Payload Output Payload Explanation { “Quote”: { “Name”: “qt1234”, “Contact”: { “First Name”: “Jack”, “Account”: { “SingleRecordAsJSONObject”: “true”, “CSN”: “88-36MIAD” } } }, “Communication”: { “Name”: “qt1234”, “Contact”: { “First Name”: “Jill”, “Account”: { “Name”: “Test Acc21”, “CSN”: “88-36MILE” } } } }{ “MyContact”: { “First_Name”: “Jill”, “Account”: { “Name”: “Test Acc21”, “ID”: “88-36MILE” } } }In this example, based on the sample schema, Account is duplicated. However, Communication → Contact → Account includes both fields, Name and CSN, as configured in the schema, while Quote → Contact → Account containsonly the CSN field. As a result, the final output contains values from Communication → Contact → Account.
- The duplicates include both records and single-element arrays: A child node
that does not have duplicate fields is selected. If no such node exists,
blank values are returned in the output. For example:
Input Payload Output Payload Explanation { "Quote": { "Name": "qt1234", "Contact": { "First Name": "Jack", "Account": { "Name": "Test Account2", "SingleRecordAsJSONObject": "true", "CSN": "88-36MIAD" } } }, "Communication": { "Name": "qt1234", "Contact": { "First Name": "Jill", "Account": [ { “Name”: “Test Acc21”, “CSN”: “88-36MILE” } ] } } }{ "MyContact": { "First_Name": "", "Account": { "Name": "", "ID": "" } } }In this example, based on the sample schema, Account is duplicated. Account appears as a record under Quote and as an array under Communication. However, because a single array element is treated as a record and both Account instances contain all the fields, the final output displays blank values.
- The duplicates include both records and multi-element arrays: A record or a
single-element array with at least one schema field is selected. If no such
record exists, blank values are returned in the output. For example:
Input Payload Output Payload Explanation { “Quote”: { “Name”: “qt1234”, “Contact”: { “First Name”: “Jack”, “Account”: [ { “Name”: “Test Acc1”, “CSN”: “88-36MIAD” }, { “Name”: “Test Acc2”, “CSN”: “88-36MILD” } ] } }, “Communication”: { “Name”: “qt1234”, “Contact”: { “First Name”: “Jill”, “Account”: { “Name”: “Test Acct21” } } } }{ “MyContact”: { “First_Name”: “Jill”, “Account”: { “Name”: “Test Acct21”, “ID”: “” } } }In this example, Account under Quote is a multi-element array and Account under Communication is a record. In this case, Account under Communication→ Contact is considered as it has one required schema field, Name, in it. As a result, the final output displays the values from Communication → Contact → Account.
- The duplicates only consist of single-element arrays: A child node that does not have duplicate fields is selected. If no such node exists, blank values are returned in the output.
- The duplicates only consist of multi-element arrays: The output returns blank values.
- The duplicates include both single-element arrays and multi-element arrays: A child node that does not have duplicate fields is selected. If no such node exists, blank values are returned in the output.
- The duplicates are of type record: A child node that does not have duplicate
fields is selected. If no such node exists, blank values are returned in the
output. For example:
- When the child node is defined as an array in the schema, and:
Sample schema for examples:
{ “type”: “record”, “name”: “ContactAndKids”, “fields”: [ { “name”: “MyContact”, “siebelName”: “Contact”, “type”: { “type”: “record”, “name”: “Contact”, “fields”: [ { “name”: “First_Name”, “type”: “string”, “siebelName”: “First Name” }, { “name”: “Account”, “type”: { “type”: “array”, “items”: { “type”: “record”, “name”: “Account”, “fields”: [ { “name”: “CSN”, “type”: “string” }, { “name”: “Name”, “type”: “string” } ] } } } ] } } ] }- The duplicates are of type record: A child node that does not have duplicate fields is selected. If no such node exists, blank values are returned in the output.
- The duplicates include both records and single-element arrays: A child node
that does not have duplicate fields is selected. If no such node exists,
blank values are returned in the output. For example:
Input Payload Output Payload Explanation { “Quote”: { “Name”: “qt1234”, “Contact”: { “First Name”: “Jack”, “Account”: [{ “SingleRecordAsJSONObject”: “true”, “CSN”: “88-36MIAD” }] } }, “Communication”: { “Name”: “qt1234”, “Contact”: { “First Name”: “Jill”, “Account”: { “Name”: “Test Acc21”, “CSN”: “88-36MILE” } } } }{ “MyContact”: { “First_Name”: “Jill”, “Account”: [ { “CSN”: “88-36MILE”, “Name”: “Test Acct21” } ] } }In this example, Account under Quote is a single-element array and Account under Communication is a record. As a result, the final output displays the values from Communication → Contact → Account as it includes all fields from the schema definition.
- The duplicates include both records and multi-element arrays: A child node
that does not have duplicate fields is selected. If no such node exists,
blank values are returned in the output. For example:
Input Payload Output Payload Explanation { “Quote”: { “Name”: “qt1234”, “Contact”: { “First Name”: “Jack”, “Account”: [ { “Name”: “Test Acc1”, “CSN”: “88-36MIAD” }, { “Name”: “Test Acc2”, “CSN”: “88-36MILD” } ] } }, “Communication”: { “Name”: “qt1234”, “Contact”: { “First Name”: “Jill”, “Account”: { “Name”: “Test Acc21” } } } }{ “MyContact”: { “First_Name”: “Jack”, “Account”: [ { “CSN”: “88-36MIAD”, “Name”: “Test Acc1” }, { “CSN”: “88-36MILD”, “Name”: “Test Acc2” } ] } }In this example, Account under Quote is a multi-element array and Account under Communication is a record. The final output displays the values from the multi-element array as it includes all fields from the schema definition.
- The duplicates consist only of multi-element arrays: A child node that does
not have duplicate fields is selected. If no such node exists, the blank
values are returned in the output. For example:
Input Payload Output Payload Explanation { "Quote": { "Name": "qt1234", "Contact": { "First Name": "Jack", "Account": [ { "Name": "Test Acc1", "CSN": "88-36MIAD" }, { "Name": "Test Acc2", "CSN": "88-36MILD" } ] } }, "Communication": { "Name": "qt1234", "Contact": { "First Name": "Jill", "Account": [ { "Name": "Test Acc11", "CSN": "88-36MITD" }, { "Name": "Test Acc21", "CSN": "88-36MILL" } ] } } } }{ "MyContact": { "First_Name": "", "Account": [ { "CSN": "", "Name": "" } ] } }In this example, both Quote and Communication have the child node Account, which includes the fields Name and CSN. As a result, none of these fields are considered and the output contains only blank values.
- The duplicates consist only of single-element arrays: A child node that does not have duplicate fields is selected. If no such node exists, blank values are returned in the output.
- The duplicates include both single-element arrays and multi-element arrays: A record or a single-element array with at least one schema field is selected. If no such node exists, blank entries are returned in the output.