diff --git a/src/app/modules/myinfo/myinfo.util.ts b/src/app/modules/myinfo/myinfo.util.ts index e8c15fddd8..ce847be7c2 100644 --- a/src/app/modules/myinfo/myinfo.util.ts +++ b/src/app/modules/myinfo/myinfo.util.ts @@ -521,7 +521,7 @@ export const handleMyInfoChildHashResponse = ( // Validate each answer (child) childAnswer.forEach((attrAnswer, subFieldIndex) => { const key = getMyInfoChildHashKey( - field._id as string, + field._id, subFields[subFieldIndex], childIndex, childName, diff --git a/src/app/modules/submission/submission.utils.ts b/src/app/modules/submission/submission.utils.ts index 495fc5f91d..e54346799f 100644 --- a/src/app/modules/submission/submission.utils.ts +++ b/src/app/modules/submission/submission.utils.ts @@ -752,17 +752,12 @@ export const getAnswersForChild = ( return [] } return response.answerArray.flatMap((arr, childIdx) => { - // First array element is always child name - const childName = arr[0] return arr.map((answer, idx) => { const subfield = subFields[idx] return { - _id: getMyInfoChildHashKey( - response._id, - subFields[idx], - childIdx, - childName, - ), + // Recreates the individual _id of the child field based on the parent field's _id and the subfield + // e.g., childrenbirthrecords.67585515e1ced6d790a91e14.childname.0 + _id: `${MyInfoAttribute.ChildrenBirthRecords}.${response._id}.${subFields[idx]}.${childIdx}`, fieldType: response.fieldType, // qnChildIdx represents the index of the MyInfo field // childIdx represents the index of the child in this MyInfo field