My workflow starts with a Form Trigger node, which lets the user upload a CSV file.
Then it reads the CSV file and asks the user in another form page to map the columns to a preset list of fields.
Is it possible to dynamically set a default value for form fields on a subsequent page of the form?
I know that you can use query parameters for the form URL, but what if I want to set the default values based on the user’s response on the first page of the form?
For example: if the CSV has a column called Business Name, I want it to automatically be mapped to the Business Name field.
My workflow
The Code node’s output is:
[
{
"formFields": [
{
"fieldLabel": "Map \"Business Name\" to:",
"fieldType": "dropdown",
"fieldOptions": {
"values": [
{
"option": "[Do Not Map]"
},
{
"option": "Business Name"
},
{
"option": "Business Start Date"
},
{
"option": "EIN"
},
{
"option": "Business Phone"
},
{
"option": "Business Email"
},
{
"option": "Owner Full Name"
},
{
"option": "Owner First Name"
},
{
"option": "Owner Last Name"
},
{
"option": "Owner Phone"
},
{
"option": "Owner Email"
},
{
"option": "Date of Birth"
},
{
"option": "SSN"
},
{
"option": "Address Street"
},
{
"option": "City"
},
{
"option": "State"
},
{
"option": "Zip Code"
},
{
"option": "Monthly Revenue"
},
{
"option": "Address"
}
],
"selectedValues": "Business Name"
},
"requiredField": false
},
{
"fieldLabel": "Map \"Drive Folder Name\" to:",
"fieldType": "dropdown",
"fieldOptions": {
"values": [
{
"option": "[Do Not Map]"
},
{
"option": "Business Name"
},
{
"option": "Business Start Date"
},
{
"option": "EIN"
},
{
"option": "Business Phone"
},
{
"option": "Business Email"
},
{
"option": "Owner Full Name"
},
{
"option": "Owner First Name"
},
{
"option": "Owner Last Name"
},
{
"option": "Owner Phone"
},
{
"option": "Owner Email"
},
{
"option": "Date of Birth"
},
{
"option": "SSN"
},
{
"option": "Address Street"
},
{
"option": "City"
},
{
"option": "State"
},
{
"option": "Zip Code"
},
{
"option": "Monthly Revenue"
},
{
"option": "Address"
}
],
"selectedValues": "[Do Not Map]"
},
"requiredField": false
},
...
{
"fieldLabel": "Map \"Owner Last Name\" to:",
"fieldType": "dropdown",
"fieldOptions": {
"values": [
{
"option": "[Do Not Map]"
},
{
"option": "Business Name"
},
{
"option": "Business Start Date"
},
{
"option": "EIN"
},
{
"option": "Business Phone"
},
{
"option": "Business Email"
},
{
"option": "Owner Full Name"
},
{
"option": "Owner First Name"
},
{
"option": "Owner Last Name"
},
{
"option": "Owner Phone"
},
{
"option": "Owner Email"
},
{
"option": "Date of Birth"
},
{
"option": "SSN"
},
{
"option": "Address Street"
},
{
"option": "City"
},
{
"option": "State"
},
{
"option": "Zip Code"
},
{
"option": "Monthly Revenue"
},
{
"option": "Address"
}
],
"selectedValues": "Owner Full Name"
},
"requiredField": false
}
]
},
{
"Business Name": "DUNCANS ALL ACCESS TRANSPORTATION",
"Drive Folder Name": "Duncans All Access Transportation",
"Business Start Date": "01/01/2010",
"EIN": "82-5279707",
"Mobile": "(845) 416-7632",
"Phone": "(845) 473-3896",
"Email": "[email protected]",
"SSN": "051-58-2347",
"Owner Full Name": "Andre Duncan",
"Birth Date": "10/16/1969",
"Address Street": "10 Corine Dr",
"City": "Poughkeepsie",
"State": "NY",
"Zip": "12601",
"Monthly Revenue ": "194,000.00",
"Owner First Name": "Andre",
"Owner Last Name": "Duncan"
},
...
{
"Business Name": "TOP DK CORP",
"Drive Folder Name": "Top DK Corp",
"Business Start Date": "10/01/2021",
"EIN": "87-3428314",
"Mobile": "(407) 640-1831",
"Phone": "(863) 421-8916",
"Email": "[email protected]",
"SSN": "253-77-6568",
"Owner Full Name": "Israel Puga",
"Birth Date": "06/24/1990",
"Address Street": "2204 Citrus Blvd",
"City": "Haines City",
"State": "FL",
"Zip": "33844",
"Monthly Revenue ": "217,000.00",
"Owner First Name": "Israel",
"Owner Last Name": "Puga"
}
]
Information on your n8n setup
- n8n version: 1.72.1
- Database (default: SQLite): SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main): not sure
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: MacOS