Please, take a look on high level overview of formContext.ui.formSelector which is tabulated below.
Scenario: I took the scenario where will set entity form based on option set value.This scenario covers ui.formselector entirely, likewise as:
Implementation: Find the code snippet below:
formContext = executionContext.getFormContext();
var caseType = formContext.getAttribute(logicalname).getValue();
changeForm(“Case for Interactive experience”);
var currentForm = formContext.ui.formSelector.getCurrentItem();
var availableForms = formContext.ui.formSelector.items.get();
if (currentForm.getLabel().toLowerCase() != formName.toLowerCase())
for (var i in availableForms)
var form = availableForms[i];
// to find a form based on the name
if (form.getLabel().toLowerCase() == formName.toLowerCase())
Call this function on page load event and make sure that this code is present on all other forms.
Testing: I am creating case record from default case form by putting up case type as Trial order.Once record is saved.It will navigate screen to trial order case form and have similar behavior for claims case form too.
Hope it is informative! 🙂 Keep dynamics-power with you.