Skip to main content
Version: 8.1

Hide functionality on a page

Level: beginner

Creatio 8 Atlas lets you execute the following actions that hide functionality on a page:

  • Hide functionality during development.
  • Hide functionality due to insufficient access permissions.

Hide functionality during development

Creatio 8 Atlas uses the sdk.FeatureService service to check functionality status.

To hide functionality during development on a page:

  1. Add a page component that contains the functionality during development at step 1 of the Freedom UI page customization procedure if needed.

  2. Set up how to hide the functionality on the page at step 2 of the Freedom UI page customization procedure.

    1. Enable the sdk.FeatureService service that checks the functionality status. Enable the service similarly to the display procedure for the value of system variables.

    2. Add an attribute that stores data to the viewModelConfigDiff schema section. Add the attribute similarly to the setup procedure for the field display condition.

    3. Bind the visible property to the corresponding model attribute in the viewConfigDiff schema section. Property binding is similar to that described in the setup procedure for the field display condition.

    4. Add a custom implementation of the crt.HandlerViewModelInitRequest system query handler to the handlers schema section. The handler is executed when the View model is initialized.

      1. Instantiate the service that checks the functionality status from @creatio/sdk.
      2. Get the status of the functionality by its code and write it to the corresponding attribute.

      View an example of a crt.HandlerViewModelInitRequest query handler that receives a feature status with the SomeFeatureCode code and writes it to the SomeAttributeName attribute below.

      handlers schema section
      handlers: /**SCHEMA_HANDLERS*/[
      {
      request: "crt.HandlerViewModelInitRequest",
      /* Custom implementation of a system query handler. */
      handler: async (request, next) => {
      /* Instantiate the service that checks the functionality status from @creatio/sdk. */
      const featureService = new sdk.FeatureService();
      /* Get the SomeFeatureCode functionality status and write it to the SomeAttributeName attribute. */
      request.$context.SomeAttributeName = await featureService.getFeatureState('SomeFeatureCode');
      /* Call the next handler if it exists and return its result. */
      return next?.handle(request);
      }
      }
      ]/**SCHEMA_HANDLERS*/,

View a detailed example that hides functionality during development in a separate article: Hide a feature at the development stage on a page.

Hide functionality due to insufficient access permissions

Creatio 8 Atlas uses the sdk.RightsService service to check access permissions.

To hide functionality due to insufficient access permissions:

  1. Add a page component with the functionality for which access permissions are configured at step 1 of the Freedom UI page customization procedure if needed.

  2. Set up how to hide functionality on the page due to insufficient access permissions at step 2 of the Freedom UI page customization procedure.

    1. Enable the sdk.RightsService service that checks access permissions. Enable the service similarly to the display procedure for the value of system variables.

    2. Add an attribute that stores data to the viewModelConfigDiff schema section. Add the attribute similarly to the setup procedure for the field display condition.

    3. Bind the visible property to the corresponding model attribute in the viewConfigDiff schema section. Property binding is similar to that described in the setup procedure for the field display condition.

    4. Add a custom implementation of the crt.HandlerViewModelInitRequest system query handler to the handlers schema section. The handler is executed when the View model is initialized.

      1. Instantiate the service that checks access permissions from @creatio/sdk.
      2. Get information about the user’s permissions to perform the corresponding action.
      3. Write the result of the checkup to the corresponding attribute.

      View an example of the crt.HandlerViewModelInitRequest request handler that checks for permissions to perform a system operation with the SomeOperationCode code and writes the result to the SomeAttributeName attribute below.

      handlers schema section
      handlers: /**SCHEMA_HANDLERS*/[
      {
      request: "crt.HandlerViewModelInitRequest",
      /* Custom implementation of a system query handler. */
      handler: async (request, next) => {
      /* Instantiate the service that checks access permissions from @creatio/sdk. */
      const rightService = new sdk.RightsService();
      /* Get information about the access permissions to a system operation that has the SomeOperationCode code. */
      const someConst = await rightService.getCanExecuteOperation('SomeOperationCode');
      /* Write the result of the checkup to the SomeAttributeName attribute. */
      request.$context.SomeAttributeName = someConst;
      /* Call the next handler if it exists and return its result. */
      return next?.handle(request);
      }
      }
      ]/**SCHEMA_HANDLERS*/,

View a detailed example that hides functionality due to insufficient access permissions in a separate article: Hide the feature on a page due to insufficient access permissions.


See also

Freedom UI page customization basics

Display the value of a system variable

Customize page fields