The Microsoft XRM JavaScript Framework provides the possbility to switch/navigate to a specific form of an entity.

Often the use case is, that a type (e.g. OptionSet) has a dedicated form which should be shown when the type is set/changed.

In the first place you have to figure out the id of your target form – this id you’ll need later to execute the switch.

This example code iterates over all available form id’s until one of the available form id’s matches your target id. After the match the navigate function is called – which will be switch forms and presents the target form to the actual user.

var targetFormId = [Your Target Form Id];
var availableForms = Xrm.Page.ui.formSelector.items.get();

for (var i in availableForms) {
     var form = availableForms[i];
       if (form.getId().toLowerCase() == targetFormId.toLowerCase()) {
                form.navigate();
       }
}