The problem occurs when users change their selections. They initially select both fields and everything functions well. However, if they go back and modify the first field (projectId), the second field (serviceId) retains its old value instead of being cleared.
I can confirm that my API function is executed correctly since the dropdown shows new options when reopened. But the previously selected value persists, which leads to an invalid selection.
Is there a way to automatically clear the dependent field when the parent field is changed?
Yeah, this is a classic Zapier CLI issue. The framework doesn’t reset dependent fields when you change parent selections - super annoying. Here’s what I’ve done to fix it: First, add validation right in the service dropdown’s dynamic function. Check if the current serviceId actually matches the selected projectId and filter out anything that doesn’t. This stops invalid options from even showing up. Second option is adding some conditional logic in your trigger/action perform function. When it catches mismatched fields, either clear the invalid serviceId or make the user pick again. Not perfect solutions, but they’ll keep your data clean until Zapier hopefully fixes this in a future CLI update.
ya, zapier cli doesn’t clear dependent fields auto. i just check if the serviceId is valid for the new projectId in my action function and return an error if not. it’s a bit of a hack, but it helps avoid invalid selections.
Had this exact problem a few months ago. Here’s what fixed it for me: add a validation check right in the service dropdown’s dynamic function. When it runs, compare the stored serviceId with the new projectId context. If they don’t match, just return the options without any pre-selected value. Make sure your service field’s dynamic function gets the current projectId as a bundle parameter - then you can check it against your API response. Not the prettiest fix since Zapier should handle this automatically, but it stops users from submitting forms with wrong data. Also consider updating your helpText dynamically to show when they need to pick again.