fix: Cannot read properties of undefined (reading 'pk')

This commit is contained in:
Ramesh Mane
2026-01-17 10:29:19 +00:00
parent 309695b6b4
commit 86c70b8974

View File

@@ -477,13 +477,18 @@ function fieldsValidation(record: Record<string, any>, tn: string) {
return false
}
if (srcDestMapping.value[tn].filter((v: Record<string, any>) => v.destCn === record.destCn).length > 1) {
if ((srcDestMapping.value[tn] || []).filter((v: Record<string, any>) => v.destCn === record.destCn).length > 1) {
message.error(t('msg.error.duplicateMappingFound'))
return false
}
const v = columns.value.find((c) => c.title === record.destCn) as Record<string, any>
if (!v) {
message.error(`Column '${record.destCn}' not found`)
return false
}
for (const tableName of Object.keys(importData)) {
// check if the input contains null value for a required column
if (v.pk ? !v.ai && !v.cdf : !v.cdf && v.rqd) {