allowCreateNew property Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/tag/allowcreatenew-property/ Microsoft Dynamics CRM . Microsoft Power Platform Sun, 07 Jun 2020 13:57:06 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/cropped-Microsoftdynamics365-blogs.png?fit=32%2C32 allowCreateNew property Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/tag/allowcreatenew-property/ 32 32 176351444 formContext.data.process.getActiveStage.getNavigationBehavior is not a function for getNavigationBehavior http://microsoftdynamics.in/2020/06/07/formcontext-data-process-getactivestage-getnavigationbehavior-is-not-a-function-for-getnavigationbehavior/ Sun, 07 Jun 2020 13:57:06 +0000 http://microsoftdynamics.in/?p=3526 The post formContext.data.process.getActiveStage.getNavigationBehavior is not a function for getNavigationBehavior appeared first on Microsoft Dynamics 365 Blog.

]]>

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.

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/06/img_5edcef1b7c001.png?fit=1703%2C730

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()”

The post formContext.data.process.getActiveStage.getNavigationBehavior is not a function for getNavigationBehavior appeared first on Microsoft Dynamics 365 Blog.

]]>
3526