OverrideConditionalNav function

Syntax

OverrideConditionalNav([mode])

Description

Use the OverrideConditionalNav function to specify how to disable conditional navigation.

Conditional navigation can be disabled for the life of a component by invoking this function as the first executable statement in a PeopleCode PreBuild event. Alternatively, conditional navigation can be temporarily disabled for just a segment of code in other PeopleCode events.

Important:

When temporarily disabling conditional navigation, you must explicitly re-enable it by calling OverrideConditionalNav(%CNAV_RestoreAll). Failing to do so will leave conditional navigation disabled for the remainder of the PeopleCode program.

The following methods, properties, and functions are “conditional navigation aware,” which means that they will generate a URL or return a value that is dependent on the conditional navigation configuration as well as on the current state as set by the OverrideConditionalNav function:

  • AbsoluteContentURL property (content reference class and content reference link class).

  • AbsolutePortalURL property (content reference class and content reference link class).

  • FindCRefByName method (PortalRegistry class).

  • FindCRefByURL method (PortalRegistry class).

  • FindCRefLinkByName method (PortalRegistry class).

  • GenerateComponentContentRelURL built-in function.

  • GenerateComponentContentURL built-in function.

  • GenerateComponentPortalRelURL built-in function.

  • GenerateComponentPortalURL built-in function.

  • GenerateComponentRelativeURL built-in function.

  • GenerateHomepagePortalURL built-in function.

  • GenerateHomepageRelativeURL built-in function.

  • GetAbsoluteContentURL method (PortalRegistry class).

  • GetURL built-in function.

  • Transfer built-in function.

  • ViewURL built-in function.

Parameters

Parameter Description

mode

Specifies how to disable conditional navigation as an Integer value.

Specify the mode as one of the following values. You can use either the numeric or constant value. Except for %CNAV_SkipAll and %CNAV_RestoreAll, any of the other constant values can be combined. For example, specifying 12 is the equivalent of specifying %CNAV_SkipDisplayMode + %CNAV_SkipToolsRel while specifying 60 is the equivalent of specifying %CNAV_SkipAll.

Numeric Value Constant Value Description

1

%CNAV_SkipAll

Note: The default value is %CNAV_SkipAll.

Ignores all conditional navigation attributes.

2

%CNAV_RestoreAll

Turns on conditional navigation

4

%CNAV_SkipDisplayMode

Ignores CN_DISPLAYMODE attributes only.

8

%CNAV_SkipToolsRel

Ignores CN_TOOLSREL attributes only.

16

%CNAV_SkipGeneric

Ignores user-defined conditional navigation attributes only.

32

%CNAV_SkipNavGroup

Ignores CN_NAVGROUP attributes only.

Note:

The skipcnav query string parameter that can be appended to a generated URL takes the same integer values that are valid for the mode parameter of the OverrideConditionalNav function. This includes the ability to combine two values by using their sum as the integer value. See Example 4 for information on how to post-process a URL to append the skipcnav query string parameter.

Returns

(Optional) An Integer value. 1 indicates the function executed successfully, 0 indicates failure.

Example 1

The following example temporarily disables all conditional navigation to generate a URL to a classic component. Then, conditional navigation is re-enabled for the remainder of the program’s execution.

OverrideConditionalNav();
rem generate the URL to base;
&url = GenerateComponentContentURL(%Portal, %Node, @("Menuname.ROLE_EMPLOYEE"), %Market, @("Component.HR_EE_NAME"), "", "U");
OverrideConditionalNav(%CNAV_RestoreAll);
ViewURL(&url, False);

Example 2

The following example, which must appear in the component PreBuild event, disables conditional navigation for the life of the component:

OverrideConditionalNav(%CNAV_SkipAll);

Example 3

The following example temporarily disables for CN_DISPLAYMODE attributes only. If other attributes types are set—for example, CN_TOOLSREL or user-defined attributes—those attributes will still be used to generate a URL to a classic component. Then, conditional navigation is re-enabled for the remainder of the program’s execution.

/* Skip display mode CNAV only */
OverrideConditionalNav(%CNAV_SkipDisplayMode);
rem generate the URL to base ;
&url = GenerateComponentContentURL(%Portal, %Node, @("Menuname.ROLE_EMPLOYEE"), %Market, @("Component.HR_EE_NAME"), "", "U");
OverrideConditionalNav(%CNAV_RestoreAll);
ViewURL(&url, False);

Example 4

The following example temporarily disables conditional navigation to generate a URL to a classic component. Then, conditional navigation is re-enabled for the remainder of the program’s execution. However, conditional navigation could be invoked at a later date whenever the generated link is clicked. Therefore, post-processing of the generated URL appends the skipcnav query string parameter to the URL to ensure that conditional navigation is always ignored for every user who clicks the link in every situation.

/* Disable conditional navigation before generating the URL. */
OverrideConditionalNav();
&URL = GenerateComponentPortalURL(%Portal, %Node, MenuName."ROLE_MANAGER", "GBL", Component."HR_PROMOTE_APPR", "", "");

/* IMPORTANT: Re-enable conditional navigation */
OverrideConditionalNav(%CNAV_RestoreAll);

&URL = &URL | "?Action=U&BUSINESS_UNIT=US100&REQ_ID=0000000067";
/* Post-processing ensures that CN is skipped when the user clicks the link.  */
&URL = &URL | "&skipcnav=1"; 

/* Invoke MCFOutboundEmail.Send to send the email including the generated URL */
...

Note:

The skipcnav query string parameter takes the same integer values that are valid for the mode parameter of the OverrideConditionalNav function. This includes the ability to combine two values by using their sum as the integer value. See the mode parameter of the OverrideConditionalNav function for more information.