Hi,
I have a scenario where I want to show a specific form based on the user's choice while creating a record.
I have created an HTML web resource which asks user to select an option and depending on the selection I want to navigate to the specific form from the available forms for the entity. PFB the code that I have come up with:
askUserToSelect: function (executionContext) {
var formContext = executionContext.getFormContext();
var alertButton = new Alert.Button();
alertButton.label = "Continue";
alertButton.callback = function () { askUserToSelectSuccessCallback(executionContext); };
//alertButton.callback = askUserToSelectSuccessCallback;
var array = new Array();
array.push(alertButton);
Alert.showWebResource("askUserForSelection.html", 700, 380, "User Choice", array, null, false, 30);
},
askUserToSelectSuccessCallback: function (executionContext) {
var formContext = executionContext.getFormContext();
var iFrameParameters = Alert.getIFrameWindow();
var userChoice = iFrameParameters.userChoice;
if (userChoice == "Form1") {
formContext.ui.formSelector.items.get(Form1_GUID).navigate();
}
else {
formContext.ui.formSelector.items.get(Form2_GUID).navigate();
}
},
Using the Ribbon Workbench tool, I have customized the command for New button on Entity Home Page to pass PrimaryControl as a parameter to askUserToSelect function. However I am getting null value in the executionContext.
Similarly, I have customized the command for New button on Entity Form page to pass PrimaryControl as a parameter to askUserToSelect function. In this scenario, the executionContext is available to use, however, it gets lost on successCallback event.