Change/Clear a reference selector when another reference selector is changed
I have two entities, Category and then Subcategory. What I want to happen is when you select a Category, you can only see the the subcategories that depend on that category. I have gotten this to work by use of XPath constraints, but the problem I'm having now is if you change the category after already selecting a subcategory, the subcategory doesn't change. I'd like to have it clear so the client would have to select a new subcategory related to that category versus the possibility of them submitting a form with an unrelated subcategory selected. Hopefully this makes sense, and thanks for any help!
Two possibilities I can think of:
use Constrained By in the Subcategory reference selector (instead of XPath). I think this will clear out the Subcategory reference selector when you change the Category (provided that the selected subcategory is not available for the the selected Category)
create a microflow that sets the Subcategory reference to empty. Call this microflow in the OnChange event of the Category reference selector