1
0
Fork 0
mirror of synced 2024-09-20 19:33:10 +12:00

Defaulting to null in the updateRow step causes issues in row mapping. Switching back to empty string

This commit is contained in:
Dean 2024-06-27 09:10:28 +01:00
parent d10ef7b795
commit 2243314314

View file

@ -87,7 +87,7 @@ export async function run({ inputs, appId, emitter }: AutomationStepInput) {
// Legacy // Legacy
// Find previously set values and add them to the update. Ensure empty relationships // Find previously set values and add them to the update. Ensure empty relationships
// are added to the update is clearRelationships is true // are added to the update if clearRelationships is true
const legacyUpdated = Object.keys(inputs.row || {}).reduce( const legacyUpdated = Object.keys(inputs.row || {}).reduce(
(acc: Record<string, any>, key: string) => { (acc: Record<string, any>, key: string) => {
const isEmpty = inputs.row[key] == null || inputs.row[key]?.length === 0 const isEmpty = inputs.row[key] == null || inputs.row[key]?.length === 0
@ -119,10 +119,7 @@ export async function run({ inputs, appId, emitter }: AutomationStepInput) {
return acc return acc
} }
acc[key] = acc[key] =
Object.hasOwn(inputs.row || {}, key) && !inputs.row[key] || inputs.row[key]?.length === 0 ? "" : inputs.row[key]
(!inputs.row[key] || inputs.row[key]?.length === 0)
? null
: inputs.row[key]
return acc return acc
}, },
{} {}