2 Problems with Actions

I’m having 2 problems with actions.

This is my SQL for the action:

DELETE FROM workers.person_month_work where calendar_month = {{calendar_month}} and person_fk = {{person_fk}};
INSERT INTO workers.person_month_work  (calendar_month, person_fk, holiday_days, sickness_days, work_hours, overtime_hours) 
values ({{calendar_month}}, {{person_fk}}, {{holiday_days}}, {{sickness_days}}, {{work_hours}}, {{overtime_hours}}) ;

First, if I reference a parameter more than once, I get this:

Error executing Action: Error preprocessing query in metabase.query-processor.middleware.parameters/substitute-parameters: Cannot run the query: missing required parameters: #{"person_fk" "calendar_month"}

The filters are correctly connected and have values. It appears to be a problem with the 2nd reference.

After the error (or any other error), all my action parameter configuration is removed. All field types are reset to text, defaults are removed and any placeholder text too.

I’m going to try a workaround for the multiple parameters by duplicating them (they are hidden), but the 2nd problem will still be an issue.

Actually, duplicating the parameters didn’t work. Looks like it’s to do with having hidden parameters that are set by filters. Any ideas?

First part solved. If you set a parameter using a filter value, it mustn’t be hidden.

2nd part still a problem - if there’s an error in a dashboard action button, the action settings are partly removed.