Object is used: An object with the allowCreateNew property that lets you define whether the Create button will be available in a stage so that user can create an instance of entityB from the entityA form in a cross-entity business process flow navigation scenario.
For example, here is the Create button in the Develop stage of the AccountToContactProcess sample business process flow that lets you create a Contact record from the Account form.
Below snippet is from Microsoft doc which needs some correction:
https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-data-process/stage/getnavigationbehavior
function sampleFunction(executionContext) {
var formContext = executionContext.getFormContext();
formContext.data.process.getActiveStage().getNavigationBehavior().allowCreateNew = function () {
if (formContext.data.process.getName() === 'Test Process') {
return false; // Create button is not available
}
else {
return true; // Create button is available
}
}
}
When I used provided snippet it gave Error : formContext.data.process.getActiveStage.getNavigationBehavior is not a function ( This issue was raised y Mr johnnylawson on forums)
Instead of “formContext.data.process.getActiveStage.getNavigationBehavior()” try using “formContext.data.process.getActiveStage().getNavigationBehavior()”