Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 2.41 KB

File metadata and controls

68 lines (49 loc) · 2.41 KB
title description author ms.author ms.date ms.reviewer ms.topic applies_to search.audienceType contributors
getNavigationBehavior (Client API reference) in model-driven apps| MicrosoftDocs
Returns a navigation behavior object for stage that can be used to define whether the create button is available for users.
HemantGaur
hemantg
03/12/2022
jdaly
reference
Dynamics 365 (online)
developer
JimDaly

getNavigationBehavior (Client API reference)

[!INCLUDE./includes/getNavigationBehavior-description.md]

Note

This method is available only for Unified Interface.

Syntax

stageObj.getNavigationBehavior().allowCreateNew = function () {
    return true|false;
}

[!INCLUDEcc-terminology]

Returns

Type: Object

Description: 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 tableB from the tableA form in a cross-table 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.

Create button in the Develop stage.

The allowCreateNew property will return undefined for business process flow records that do not implement cross-table navigation.

Example

The following sample code shows how you can hide or display the Create button for an active stage of a business process flow depending on its name.

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
        }
    }
}

Related articles

formContext.data.process

[!INCLUDEfooter-include]