@Femi and I are working on a project where we would like to be able to conditionally mute contacts when a certain form is submitted, but only when a particular value is given for a field on that form.
The muting.validations configuration seems to provide the functionality we need. However, in the false case where we do not want to mute the contact (and so the validation check fails), an error is generated (for the failed validation) and attached to the report. This causes the red error icon to show up on the report:
This does not really make sense in our use case since there was no error with the report. Everything functioned properly and the muting was not applied (which is what we wanted to happen).
So, my question is if there is a different way to conditionally mute contacts besides the muting.validations and/or if there is a way to fail the validation without getting an error? (I did not see any way to do this in the muting logic…)
Could you try to use extra docs functionality?
Change your submitted form to not trigger muting by default, and instead, conditionally, create an extra doc that is a muting form.
For the record, I did confirm that this logic works as expected. In my test config, I set the muting.mute_forms in my app_settings.json to contain “mute_person”. Then I created a separate form (not mute_person) that just has a text field question. If the user enters “mute” into the text box, then a new mute_person report is created for the patient and the patient is muted as expected.
@jkuester it is helpful to point out that the (calculated) values for form, type and content_type should be strings (wrapped in quotes): "mute_person", "data_record", and "xml", respectively - at least that’s how I got it to work with v3.15.0.