Form submission keeps running

If I click "submit" when the form is empty, it keeps running without throwing an error.
I'm doing "Bulk Upsert using Primary Key". Array of records to update is created by a transformer.
The transformer looks like:

var initData = { "month" : {{ month.value }}, "year" : {{ year.value }}, "employee_email" : {{companyEmail.value}} }
var listViewData = {{form.data.listView1}}
var id = { "id" : {{query.data.id['0']}} }
const result = listViewData.map(item => Object.assign({}, item, initData, id))
return result

Hey @piusjin!

Could you share the value of your transformer when the form is empty as well as the form.data object?

I'm wondering if listViewData is populating correctly and whether or not something like {{ yourTransformer.value ?? [] }} will work in your upsert query.

Hi @Kabirdas ,
I get the following error message:
message:"Cannot read properties of undefined (reading 'map')"

I see, that would make sense if {{ form2.data.listView1 }} is still undefined at the moment you run the query. One way that you might be able to work around that in the transformer itself is to use optional chaining:

const result = listViewData?.map(item => Object.assign({}, item, initData, id)) ?? SOME_DEFAULT_VALUE

That will check to see if listViewData is defined before attempting to map over its value and if it's not just return some default value instead.

Does that work?