Business Process Flows (BPF for short) are used in CRM systems to guide users towards a desired outcome by defining steps for users to follow. In some instances, these processes are added to entities, such as the Lead entity, and can be very useful and for other instances they may not be needed. During a recent project an entity was created which needed to make us of a BPF only when a certain field was populated. When that field contained data the BPF would appear near the top of the form, and when the field was empty it would disappear.
To hide or show the BPF, you can use the function call ‘Xrm.Page.ui.process.setVisible()’ which would set the visibility of the BPF. Because only one BPF should be visible on a form at a time there is no need to use a process id. Passing a Boolean to ‘setVisible()’ would result in the BPF hiding or showing, where true would show the BPF and false would hide it. If you wanted to collapse or expand the BPF Xrm.Page.ui.process also has a function call ‘setDisplayState()’ which takes a string of either ‘collapsed’ or ‘expanded’. The screenshot below shows the form when the ‘Player Position’ field is populated, resulting in the setVisible() function call being set to true.