Skip to content

Commit 1044933

Browse files
committed
Wrong mapping in case the fields are in the incorrect order (AcumaticaWriter)
1 parent ed6fda3 commit 1044933

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/NoFrillsTransformation.Plugins.Acumatica/AcumaticaWriter.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,18 @@ public void FinishWrite()
126126
bool[] isNullable = new bool[_fieldNames.Length];
127127
for (int i = 0; i < _fieldNames.Length; ++i)
128128
{
129-
isNullable[i] = _entityConfig?.Table?.Columns?[i].Nullable == "true";
129+
// Find the field by name in the config file
130+
// and check if it is nullable
131+
// If the field is not found, it is not nullable
132+
isNullable[i] = false;
133+
for (int j = 0; j < _entityConfig?.Table?.Columns?.Length; ++j)
134+
{
135+
if (_fieldNames[i] == _entityConfig.Table.Columns[j].Name)
136+
{
137+
isNullable[i] = _entityConfig.Table.Columns[j].Nullable == "true";
138+
break;
139+
}
140+
}
130141
}
131142

132143
Comparison<string[]> comparison = (a, b) =>

0 commit comments

Comments
 (0)