I am running into an issue when setting a business process flow field to be required conditionally with JavaScript. I can successfully set the red asterisk on the client side next to the business process flow field in the stage, however, when the "Next Stage" button is clicked, this hidden system function on the button click is not checking client side validation for these required fields, and allows the user to proceed to the next stage without throwing an error. Has anyone else had this same issue, and what have you done to overcome it?
Some questions you may have: I have multiple Yes/No fields in the first stage, and pending the selection of any of these fields as "Yes," I want to require that the user need to click a corresponding Yes/No completed field at a stage later in the process. So, while I could make multiple branches to handle field requirement in the business process flow, it gets messy very quickly by adding tons of "possible" paths. I should be able to conditionally set requirement of a field in the process, and there should be client side validation when the user attempts to proceed to the next step.
Is there something I'm missing?
Thanks!
sample code of how I'm setting field requirement in BPF header:
function setRequiredFields() { var myField = Xrm.Page.getAttribute("bit_myfield").getValue(); var bpfControl = Xrm.Page.getControl("header_process_bit_laboradded").getAttribute(); if (needLabor === true) { bpfControl.setRequiredLevel("required"); } else { bpfControl.setRequiredLevel("none"); } }
*This post is locked for comments