verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
95 stars 70 forks source link

Adding an "agree" field default value to existing submissions #1965

Open romainpoirier opened 2 months ago

romainpoirier commented 2 months ago

Question

In a project using Formie 2.0.43, I have a form that has been previously opened and has received numerous submissions. I forgot to add an "Agree" type field to this form, which I have now added.

How can I ensure that all previous submissions, which existed before adding the "Agree" field, inherit the checked status by default?

I checked the database, but oddly, I cannot find a tinyint(1) column corresponding to the handle of the newly added field in the form's table.

Additional context

No response

engram-design commented 2 months ago

You'd have to go through an set all submission's content to be true for that agree field. Something like:

./craft resave/formie-submissions --set myCustomField --to true
romainpoirier commented 2 months ago

Thank you, but it looks like it doesn't work:

Command:

./craft resave/formie-submissions --form-id=116386 --set myField --to true

Response:

- [1/880] Resaving 2023-09-19 09:37:42 (351014) ... error: Getting unknown property: verbb\formie\elements\Submission::true

I got the same kind of error when using 1 instead of true.

Is this feature available in a more recent version than 2.0.43?

engram-design commented 2 months ago

My mistake, the syntax is a little different.

./craft resave/formie-submissions --form-id=116386 --set myField --to "=true"