Functional options (1Cv82). Functional options

Almost all standard solutions on the 1C:Enterprise 8.x platform use the functional options mechanism. It allows you to manage configuration functionality in a block-by-block manner.

For example, the “Use internal orders” option (see screenshot on the right) allows you to make this document available for use in 1C:Enterprise mode to the user, and also includes separate branches of algorithms related to this functionality.

Today in the article we will look at the operation of functional options, their configuration and a small example of their use on a test configuration. Let's start by looking at how they work.

Principle of operation

As mentioned above, a functional option allows you to enable/disable the configuration functionality associated with it. Let's look at the sequence of actions to create and configure this configuration object.

In the configuration branch "General-> Functional options" we can create a new object or view the properties of already created options. In the test configuration, we will create the “EnableImportance” functional option. At the very beginning, when the object has not yet been configured, the window for the list of its properties will look like this:

The "Name" and "Synonym" properties have a standard purpose. Of particular interest are the “Storage” and “Composition” settings.

In the "Storage" field, select an object in the configuration from which the functional option will receive the value. Typically, Boolean constants are used for these purposes. Based on the value of the constant, the platform will determine whether to enable the related functionality or not.

Configuration options associated with a functional option are configured in the Contents tab. The screenshot above shows a list of objects to be included in its composition.

If one configuration object is included in several functional options, then it will be used in application solution, if at least one of them is enabled.

The "Privileged mode on receiving" option allows you to disable access rights checking when receiving the value of a functional option, which will have a positive impact on performance (unnecessary operations of checking access rights will be eliminated) and will reduce the complexity of further development (no need to configure rights for the object storing the value of the functional option ).

Usage example

In our test configuration, we will create the "Importance" enumeration, as well as a constant

"EnableImportance". The created objects are shown in the following screenshot.

The constant is intended to store the value of a functional option. The enumeration will act as the value of the reference attribute in the test document, the availability of which will be determined by the functional option.


The test document will contain two details:
  • "Comment" with type "String".
  • "Importance" with type "EnumerationRef.Importance".

Let's add the document attribute "Importance" to the functional option and then consider the behavior of the platform in user mode.

Having launched the program in 1C:Enterprise mode, open a test document. We will not see the “Importance” attribute on the form, since we have not yet enabled the functional option.

To enable the use of the "Importance" attribute, you must set the value of the "EnableImportance" constant to TRUE. Then the form will change as follows:

The functionality of functional options applies to almost all configuration objects, with the exception of some from the “General” branch, which mainly perform service functions. For example, you cannot include other functional options within a functional option (and this doesn’t make much sense).

Let's look at a few interesting moments work of this object configurations:

1. Setting functional options has virtually no effect on the SQL queries generated by the platform.

For example, when opening a document with a disabled functional option, the platform in any case receives the value of this attribute in the request. The following screenshot shows SQL queries generated with the option enabled and disabled.

2. The "Importance" form element on the form, regardless of the value of the functional option, always has the values ​​for the "Visibility" and "Accessibility" properties equal to TRUE.

Indeed, both when creating a form on the server, and when opening the form, as well as during further work with it, the “Visibility” and “Accessibility” properties are not automatically set to FALSE by the platform. Probably 1C:Enterprise 8.x does this behind the scenes.

3. To obtain the value of a functional option, the platform generates an SQL query to the DBMS in accordance with the storage object, i.e. to a constant. In one of the previous articles, we already talked about constructing SQL queries to constants and the method of storing them in the database.


In our example, the platform generates the following SQL query:

As for the moment of obtaining the value of a functional option, the platform is guided by the following principle : The first acquisition of the value of a functional option occurs when accessing the object/attribute included in its composition. The platform then uses the cached value until the value of the object that stores this value is changed (in our example, the "EnableImportance" constants) or the user session is restarted. The value of the functional option is cached within a separate session.


All of the above was verified experimentally. Everything that I used for experiments is in the test configuration (link at the end of the article), with the exception of .

Conclusion

Functional options are an integral part of almost any circulation solution on the 1C:Enterprise 8.x platform. It is thanks to this mechanism that you can create configurations with block-based functionality that can be easily turned on/off when setting up the program. In this case, the capabilities of the mechanism can be expanded by using functional options parameters, but this is a topic for another article.

For experience with the platform, it is very rare to use functional options, since the customer knows exactly what he needs. And creating some kind of universal mechanisms, for which you will have to pay extra, plus it is not a fact that they will be used, is very rare when finalizing standard solutions or implementing them at a specific enterprise.

Files for download:

Print (Ctrl+P)

1. Purpose of functional options

Functional options allow the developer to describe the capabilities of the application solution, which can be quickly turned on or off at the implementation stage and/or during system operation. For example, the ability to work with additional product properties can be separated into a separate functional option. Then, if you disable this feature, all related (with additional product properties) capabilities will “disappear” in the application solution interface.
The system is able to automatically take into account the state of the settings made - hide disabled features, making the application interface clearer and more understandable to the user.
During development, situations arise when the value of a functional option must depend on certain parameters, for example, not all organizations maintain currency accounting. To implement such a dependency, use Functional Options Parameters - objects that parameterize functional options.

2. What do functional options affect?

2.1. general information

Functional options may have an impact:
● To the user interface - when you disable any functional options, the system hides all elements related to it in the user interface. The following interface elements are affected:
● global command interface;
● form details (including columns of form details of the Value Table or Value Tree type);
● form commands;
● reports implemented using a data composition system.
ATTENTION! If the client application is running with file version information base via the web server, then changing a functional option will change the user interface only after restarting the web server (restarting the client application will not change the user interface).
● For algorithms written in a built-in language – it is possible to obtain the values ​​of functional options from the built-in language and use them in different conditions, for example, to reduce the amount of computation.
ATTENTION! Functional options and their parameters do not affect the composition of the database. All tables and fields are present in the database regardless of the state of the functional options.

2.2. Global command interface

The effect of functional options on the global command interface is that the system hides the commands of all objects related to disabled options. For example, if the value of the Purchasing functional option is equal to False, then the commands for opening the Purchasing section, creating a Goods Receipt document, opening the Goods Receiving list, etc. will be hidden.
In turn, the Purchasing option can take into account the value of a functional option parameter, for example, Organization. By changing the value of this parameter using built-in language methods, you can change the state of the functional option, and, consequently, the visibility of the interface element.
You should also take into account the following features of the command interface formation:
● The command will be excluded from the command interface if the attribute that is a command parameter is disabled by a functional option.
● A command will be excluded from the command interface if the command parameter type is disabled by a functional option. If a command's parameter type is compound, the command becomes unavailable when all parameter types are disabled.

2.3. Form

In a form, functional options can influence the form details and commands and (as a result) change the visibility of the form elements associated with them (fields and columns for form details, buttons for form commands). When developing a form, it is necessary to take into account the following features of the system behavior:
<Вид>An object ( DirectoryObject t, DocumentObject, etc.) will be disabled if the corresponding configuration object is disabled by the functional option. Only those functional options that do not have parameters are analyzed.
● Basic attribute of a managed form type DynamicList will be disabled if the functional option disables the configuration object that is specified as the main table of the dynamic list. Only those functional options that do not have parameters are analyzed.
● The form attribute of a reference type is disabled if the configuration object that forms this type is disabled by a functional option. The form attribute of a composite type is disabled if the functional options disable all constituent types.
● The type form attribute is disabled<Вид>An object (including the main form attribute), if the configuration object forming this type is disabled by a functional option. Only those functional options that do not have parameters are analyzed.
● A form table will be disabled if it displays form attribute data that is disabled by a functional option.
● There are no types in the type selection dialog (for example, for input fields associated with attributes of a complex type) if the configuration objects that form these types are disabled by a functional option. Information about types disabled by functional options is cached on the client side and cleared after 20 minutes or during a method call UpdateInterface().
ATTENTION! Unlike the command interface, the values ​​of the functional options parameters are set only for a specific instance of the form.

2.4. Data composition system

The data composition system is primarily used for generating reports. Functional options affect the composition of the data that is displayed in the report and the composition of the report settings available to the user. For example, if the Currency accounting functional option is disabled, then in the report that displays the document register Goods receipt, there will be no column Currency and Currency amount, and in the settings there will be no ability to select, group, sort, etc. by the Currency field.

2.5. Characteristics

Functional options affect the visibility of form fields that display the value of an object's characteristic. To do this, you must include in the functional option an attribute that stores the value of the characteristic.
Let's look at an example. Characteristics are used for the Products directory, types of characteristics are stored in the plan types of characteristics Characteristics, and values ​​- as a resource of the information register Characteristics values. The resource is included in the functional option Accounting of Characteristics.

Rice. 1. Impact of functional options on performance

In case of disabling the functional option Accounting of Characteristics In the forms, the visibility of the fields (Value column and Value field) that display the characteristic values ​​is disabled, as shown in Figure 1.

3. General scheme of work

The functional options mechanism includes two types of metadata objects: Functional option And .
A functional option is a metadata object that can directly influence the composition of the application's interface (if the functional option stores its value in a Boolean attribute). Using objects of this type, you can hide elements that are related to unavailable functionality. For example, the Currency accounting option can hide the Currencies directory, the Currencies field from documents, and the Currency amount column from reports. The source of the value of a functional option is the metadata object selected as the Storage property, for example this
may be a constant.
If the value of a functional option is stored in a directory attribute or an information register resource, additional information is required that indicates exactly how to select the option value. For this purpose, a separate metadata object is provided - Functional Options Parameters.
We can say that the parameters of functional options are the coordinate axes of the value space of functional options. Moreover, one parameter of functional options can determine the value of “its” coordinate axis simultaneously for many functional options.


Rice. 2. Parameterizable function option

Let's consider an example: let's say total accounting depends on a warehouse owned by a specific organization (see Fig. 98). In our information database
You can keep records on behalf of different organizations and in different warehouses.
To store the values ​​of functional options, we will create an information register, where the dimensions (coordinate axes) will be:

● Organization (of the appropriate type);
● Warehouse (of the appropriate type).

The information register resource will be the value of the total accounting functional option.
Then the overall configuration structure will look like this:
Register of information TotalAccounting:
● Organization dimension;
● dimension Warehouse;
● resource SummovayaAccount, which has the Boolean type.
● Functional options parameter Organization. The Usage property indicates the Organization of information register dimension SummativeAccounting.
● Functional options parameter Warehouse. The Usage property points to the SumAccounting information register Warehouse dimension.
● Functional option SumAccounting. The Storage property points to the SummovayaAccounting resource for the SummovayaAccounting information register.
As a result, in order to determine the need to maintain total accounting, we need to indicate in each specific case the values ​​of the parameters of the functional options (Organization and Warehouse) and obtain the value of the functional option.
So, in the example shown in Fig. 2, total accounting is allowed for Organization 1 and Warehouse 1, but total accounting is prohibited for Organization 2 and Warehouse 1.

4. Interaction with other objects

Functional options can be assigned to the following configuration objects:
● Subsystems,
General commands,
● General forms,
● Constants,
● Selection criteria,
● Directory,
● Document,
● Magazine,
● Chart of accounts,
● Plan of types of characteristics,
● Plan of calculation types,
● Business process,
● Task,
Exchange plans,
● Report,
● Processing,
● Accumulation register,
● Information register,
● Accounting register,
● Calculation register,
● Team,
● Metadata object details,
● Tabular part,
● Details of the tabular section,
● Accounting attribute,
● Subconto accounting attribute,
● Addressing details,
● Register measurement,
● Register resource.
Functional options can also affect the visibility of form elements.

5. Creation

5.1. Creating a Function Option

In order to create a functional option, you need to create a configuration object Functional Option. This can be done in the Configurator mode in the usual way, that is, in the configuration window, select General, then Functional options and add a new object.

Rice. 3. Creating a functional option

This will create a Functional Option configuration object that can be used to assign functional options to other metadata objects.


Rice. 4. Storing the value of a functional option

In addition to the name, the object has a required property – Storage. In the editor, you can select one of the objects for it, which will be the source of the option value. The list of available objects includes:
● constants,
● directory details,
● resources of information registers.
There is no restriction on the source type of the option value, but only those functional options that store their values ​​in attributes of the Boolean type are suitable for managing the interface. Functional option values ​​with other types are only available for parsing in the built-in language.
The Privileged mode on retrieval property controls how the value of a functional option is retrieved (and cached).


Rice. 5. Privileged mode when receiving the value of a functional option

If this property is set, the value of the functional option is obtained in privileged mode. The resulting value is cached for all sessions associated with this infobase.
If the Privileged Mode property is cleared on retrieval, then retrieving the value of a functional option is performed in normal mode.
Caching is performed for the current session. Both the value (if it was possible to obtain it) and the sign of the impossibility of obtaining the value (if it was not possible to obtain the value) are cached.
The cache is reset when session parameter values ​​are changed.
ADVICE. It is recommended to set the Privileged Mode on Receive property for all cases where the value of a functional option does not contain sensitive information.

5.2. Creating a Functional Options Parameter

To create a functional option parameter, you need to create a configuration object Functional Options Parameters. This can be done in the Configurator mode in the usual way, that is, in the configuration window, select General, then Functional Options Parameters and add a new object.

In addition to the name, the parameter has a required Usage property. It specifies a set of objects whose values ​​will determine how the value of a functional option should be selected. The list of available objects includes directories and information register dimensions. For each functional options parameter in this list you can select one directory (from the entire list of directories) and one dimension of each information register.
ATTENTION! You cannot use the same metadata object in multiple function option parameters.

6.Usage

6.1 Assigning metadata to objects

A metadata object (for example, a directory) can be assigned to one or more functional options. To do this, use the Functional options property, which contains links to functional options created in the configuration.

Rice. 6. Assigning a functional option to an object

List available options limited only to those options for which the Storage property is assigned an object with a value type of Boolean.
ATTENTION! If an object is not assigned any functional options, then it is considered always visible. Otherwise, an object is considered visible if at least one of the functional options assigned to it is enabled (that is, the functional options are “ORed”).

6.2. Assignment to form details and commands

Objects belonging to the form (Details and Commands) can also be used in the functional options mechanism.


Rice. 7. Assigning a functional option to a command

This can be done in the form editor by setting the Functional options property for the required object.
The state of functional options will affect the display of form objects in the same way as it does with metadata objects.
For example, in the case of a command that is disabled using a function option, all associated buttons will be removed.
If no functional option is assigned to a form attribute or command, then the form attribute or command is always considered visible. Otherwise, a form attribute or command is considered visible if at least one of the functional options assigned to it is enabled.

6.3. Use in a data access restriction mechanism

Under the data access restriction mechanism Functional options can be used in the same way as Session Options. It is permissible to use only options that do not depend on parameters, that is, those that are bound to constants.
ATTENTION! The system controls the uniqueness of names between session parameters and functional options.

6.4. Determining the value of a functional option

The value of the functional option is determined by the object that is specified in the Storage property. In the case of a constant, its value is used. For an option associated with a directory attribute or an information register resource, the values ​​stored in these objects. In order to find a specific object that stores the value of a functional option, additional information is needed - a set of values ​​for the parameters of functional options.
If an option is stored in a directory attribute, the parameter must contain a link to a specific directory element. If the option is stored in a detail register resource, the values ​​of all dimensions of the register must be specified. In this case, each measurement must be characterized by its own parameter.
If not all parameters are specified for a functional option of type Boolean, then OR addition of all values ​​with unspecified parameters is performed. For example, if a functional option is stored in an information register with the dimensions Organization and Warehouse and only the Organization dimension is specified, then the value of the functional option will be equal to True if at least one of the warehouses listed in the Warehouse dimension has the value of the functional option equal to True.
For a function option that is of a type other than Boolean, the situation with incompletely specified parameters results in an exception being thrown.
Built-in language methods allow you to get the value of an option, both depending on the parameters passed and for the parameters set
for a command interface or a specific form. In the case when changing the value of an object specified in the Storage functional option property is performed in a transaction, the actual value of the functional option will be changed only after the transaction is completed. While the transaction is open, the value of the functional option will be equal to the value that was current at the start of the transaction.
If a functional option is tied to a periodic information register resource, then the system uses a slice of the latter to obtain the option value. If you want to get the value of an option for some other date, you must specify a value for the functional options parameter Period (Period), which has the type Date, which will be used as the date for receiving the slice. This parameter does not need to be created in the metadata. It is provided automatically by the system.

When using parameterized functional options, consider the following behavior:
● In list forms, the attribute column associated with a parameterized functional option will be displayed if at least one enabled value of this functional option is stored in the infobase.
● If it is necessary that when opening a form, the details associated with functional options are disabled by default, then you need
set the values ​​of these parameters to values ​​that are not in the infobase (for directories - an empty link, for information registers - measurement values ​​for which there are no records). In this case, the functional option will have the value False.
● In the case when a reference to a group is specified as a parameter (if the parameter type of the functional option allows the creation of groups), and not a reference to an element, the system behavior will be as follows:
● if the attribute in which the value of a functional option is stored is used for both an element and a group, then the value of the functional option will be determined by the value of this attribute.
● if the attribute in which the value of a functional option is stored is not used for a group, then when obtaining the value of a functional option using methods GetFunctionalOption(), () and () will be returned NULL value. If a feature option parameterized with this value has an impact on the user interface, the system will treat it as disabled (the feature option will have the value False).
● For command-forming metadata objects, it is possible to set a binding to a parameterized functional option. In the command interface, commands of such objects will be displayed only if there is at least one combination of functional option parameters for which the value of the functional option is True. However, using the () method, you can set specific values ​​for the parameters of functional options, and then the visibility
commands will be determined exactly by the specified parameters.
● The dynamic list automatically uses the functional options used by the form. If the details that are used in a dynamic list request are disabled for a given combination of functional options parameters, data for them will not be selected and displayed in the dynamic list, and the attribute will be removed from the lists of available details in the data display settings dialog
dynamic list (in 1C:Enterprise mode).

7. Working with functional options in the built-in language

Global Context Methods GetFunctionOption() And GetInterfaceFunctionalOption() return the value of the function
options. The difference between them is that the first method allows you to specify a set of parameters for functional options, and the second method returns the value of a functional option based on the parameters specified for the command interface. The form has its own method that returns the option value for the parameters specified within the form - GetFunctionalOptionForm().
To update the global command interface, you must explicitly call the method Set Parameters of Functional Interface Options().
The command interface will be updated to reflect the new state of functional options.
NOTES E. If the value of a functional option changes in the database, then automatic update There is no global command interface or open forms at this time. To do this you should use the method UpdateInterface() after writing the values ​​of functional options to the database.
Please remember that setting the functional options parameters (and executing the method UpdateInterface()) leads to the following consequences:
● for each form, the closing of all auxiliary forms is called (with the corresponding handlers being called);
● forms that refuse to be closed are not closed;
● the composition of the elements of the main form is updated;
● if the main form was the active form at the time of updating the interface, the main form is displayed in accordance with the new composition of elements;
● if at the time of updating the interface the active form was an auxiliary form, then:
● the command to open the auxiliary form will be executed, if it is available after updating the interface;
● otherwise, the composition of the elements of the main form is updated and it is displayed;
● if at the time of updating the interface the active form was an auxiliary form opened using a command not related to the form navigation panel, then instead of this form the composition of the elements of the main form will be updated and it will be displayed.
To update a specific form, you must either reopen it or call the method SetFormFunctionalOptionsParameters(),
in this case, the above-described sequence of actions works only for the form in the context of which the setting of the parameters of the form’s functional options is called.
It is not necessary to specify all the parameters at once; you can change the value of a specific parameter or set of parameters selectively. But it is the group setting of values ​​with one call that is more effective.
To obtain parameter values, you must call the corresponding function ( GetParametersFunctionalOptionsInterface() or
GetFormFunctionalOptionsParameters()), which will return the set parameters in the form of a structure, where the key will be the parameter name.
When opened, the form automatically uses the parameters of the functional options set for the command interface.

Purpose

Functional options allow the developer to describe configuration capabilities that can be quickly turned on or off at the implementation stage and/or during system operation. For example, the ability to work with additional product properties can be separated into a separate functional option. Then if you disable this feature, all related (with additional product properties) features will “disappear” in the configuration interface.

The system is able to automatically take into account the state of the settings made - hide disabled features, making the application interface clearer and more understandable to the user.

During development, situations arise when the value of a functional option must depend on certain parameters, for example, not all organizations maintain currency accounting. To implement such a dependency, use the Functional Options Parameters - an object that parameterizes functional options. What do functional options affect?

Functional options may have an impact:

  • to the user interface – when you disable any functional options, the system hides all elements related to it in the user interface. The following interface elements are affected:
    • global command interface;
    • forms;
    • reports implemented using a data composition system.
  • algorithms written in a built-in language - it is possible to programmatically obtain (and set) the values ​​of functional options and use them in various conditions, for example, to reduce the amount of calculations.

Global command interface

The effect of functional options on the global command interface is that the system hides the commands of all objects related to unavailable options. For example, if the value of the Purchasing functional option is False, then the commands for opening the Purchasing section, creating a Goods Receipt document, opening the Goods Receiving list, etc. will be hidden.

In turn, the Purchasing option can take into account the value of a functional option parameter, for example, Organization. By changing the value of this parameter using built-in language methods, you can change the state of the functional option, and therefore the visibility of the interface element.

Form

In a managed form, functional options can affect form attributes, commands, and (as a result) their associated form elements.

The visibility of the fields and tables of the managed form depends on the visibility of the form details, and the visibility of the buttons depends on the visibility of the commands.

Data composition system

The data composition system is primarily used for generating reports. Functional options affect the composition of the data that is displayed in the report and the composition of the report settings available to the user. For example, if the Currency Accounting functional option is disabled, then the report displaying the register of Goods Receipt documents will not have the Currency and Currency Amount columns, and the settings will not have the ability to select, group, sort, etc. by the Currency field.

For more information about the impact of functional options on the availability of fields in a report, see the “Functional options and permission to view fields in a report” section of the “Managed Reports” chapter.

General scheme of work

The functional options mechanism includes two types of metadata objects: Functional Option and Functional Options Parameter.

A functional option is a metadata object that directly affects the composition of the application interface. Using objects of this type, you can hide elements that are related to unavailable functionality. For example, the Currency accounting option can remove the Currency directory, the Currency field from documents, and the Currency amount column from reports. The source of the value of a functional option is the metadata object selected as the Storage property, for example this could be a constant.

If the value of a functional option is stored in a directory attribute or an information register resource, additional information is required that indicates exactly how to select the option value. For this purpose, a separate metadata object is provided - Functional Options Parameter.

We can say that the parameters of functional options are the coordinate axes of the value space of functional options. Moreover, one parameter of a functional option can determine the value of “its” coordinate axis simultaneously for many functional options.

Let's look at an example: let's say quantitative accounting depends on the unit within the organization. In our information database you can keep records on behalf of different organizations.

To store the values ​​of functional options, we will create an information register, where the dimensions (coordinate axes) will be:

  • Organization (of the appropriate type);
  • Division (of the appropriate type).

The information register resource will be the value of the quantitative accounting functional option.

Then the overall configuration structure will look like this:

  • Register of information QuantitativeAccounting:
    • Dimension Organization,
    • Dimension Division,
    • QuantitativeAccounting resource of type Boolean.
  • Functional options parameter Organization. The Usage property indicates the Organization of information register dimension QuantitativeAccounting.
  • functional options parameter Department. The Usage property indicates the QuantitativeAccounting information register division dimension.
  • The QuantitativeAccounting functional option, the Storage property, points to the QuantitativeAccounting resource of the QuantitativeAccounting information register.

As a result, in order to determine the need to maintain quantitative accounting, in each specific case we need to indicate the values ​​of the parameters of the functional options (Organization and Division) and obtain the value of the functional option.

Interaction with other objects

Functional options can be assigned to the following configuration objects:

  • Subsystems,
  • General commands
  • Constants,
  • Selection criteria,
  • Directory,
  • Document,
  • Magazine,
  • Chart of accounts,
  • Plan of types of characteristics,
  • Plan of calculation types,
  • Buisness process,
  • Task,
  • Exchange plans,
  • Report,
  • Treatment,
  • Accumulation register,
  • Register of information
  • Accounting register,
  • Calculation register,
  • Team,
  • Metadata object details,
  • tabular part,
  • Details of the tabular part,
  • Accounting sign
  • Subconto accounting attribute,
  • Addressing details
  • Register measurement,
  • Register resource.

Functional options can also affect the visibility of form elements.

Creation

Creating a Function Option

In order to create a functional option, you need to create a configuration object Functional Option. This can be done in the Configurator mode in the usual way, that is, in the configuration window, select General, then Functional options and add a new object.

This will create a Functional Option configuration object that can be used to assign functional options to other metadata objects.

In addition to the name, the object has a required property - Storage. In the editor, you can select one of the objects for it, which will be the source of the option value. The list of available objects includes:

  • constants,
  • directory details,
  • information register resources.

There is no restriction on the source type of the option value, but only those functional options that store their values ​​in attributes of the Boolean type are suitable for managing the interface. Functional option values ​​with other types are only available for parsing in the built-in language.

Creating a Functional Options Parameter

To create a Functional Option Parameter, you must create a configuration object of the same name. This can be done in the General branch, Functional options settings.

In addition to the name, the parameter has a required Usage property. It specifies a set of objects whose values ​​will determine how the value of a functional option should be selected. The list of available objects includes directories and information register dimensions. For each functional options parameter in this list, you can select one directory (from the entire list of directories) and one dimension of each information register.

Usage

Assigning metadata to objects

A metadata object (for example, a directory) can be assigned to one or more functional options. To do this, use the Functional options property, which contains links to functional options created in the configuration. The list of available options is limited only to those options for which the Storage property is assigned an object whose value type is Boolean.

Assignment to form details and commands

Objects belonging to the form (Details and Commands) can also be used in the functional options mechanism.

This can be done in the form editor by setting the Functional options property for the required object.

The state of functional options will affect the display of form objects in the same way as it does with metadata objects. For example, in the case of a command that is disabled using a function option, all associated buttons will be removed.

If no functional option is assigned to a form attribute or command, then the form attribute or command is considered always visible. Otherwise, a form attribute or command is considered visible if at least one of the functional options assigned to it is enabled.

Use in a data access restriction mechanism

Under the data access restriction mechanism, Functional Options can be used in the same way as Session Options. It is permissible to use only options independent of parameters, that is, those that are bound to constants.

Determining the value of a functional option

The value of the functional option is determined by the object that is specified in the Storage property. In the case of a constant, its value is used. For an option associated with a directory attribute or an information register resource, the values ​​stored in these objects. In order to find a specific object that stores the value of a functional option, additional information is needed - a set of values ​​for the parameters of functional options.

If an option is stored in a directory attribute, the parameter must contain a link to a specific directory element. If the option is stored in a detail register resource, the values ​​of all dimensions of the register must be specified. In this case, each measurement must be characterized by its own parameter.

Built-in language methods allow you to get the value of an option, both depending on the passed parameters and for parameters set for the command interface or a specific form (for more details, see the section “Working with functional options in the built-in language” of this chapter).

If a functional option is tied to a periodic information register resource, then the system uses a slice of the latter to obtain the option value. If you want to get the option value for some other date, you must specify a value for the functional options parameter Period (Period), which has a Date type, which will be used as the date for receiving the slice. This parameter does not need to be created in the metadata. It is provided automatically by the system.

Managing Functional Options Parameter Values

Parameter values ​​are set using built-in language methods. In this case, it is possible to delimit the scope of the parameter values. Parameters can be set throughout the command interface and within a specific form instance.

Working with functional options in the built-in language

Methods for working with functional options can be divided into two parts:

  • methods for getting the option value,
  • methods of working with parameters of functional options.

Working with Functional Option Values

The global context methods GetFunctionalOption() and GetFunctionalInterfaceOption() return the value of the functional option. The difference between them is that the first method allows you to specify a set of parameters for functional options, and the second method returns the value of a functional option based on the parameters specified for the command interface.

A managed form has its own method that returns the option value for the parameters specified within the form - GetFormFunctionalOption().

Working with Functional Options Parameters

Methods for working with functional options parameters allow you to get and set the values ​​of functional options parameters for a command interface or a specific form. To set the values ​​of functional option parameters, you need to call the corresponding function (SetInterfaceFunctionalOptionParameters() or SetFormFunctionalOptionParameters()), passing it as a parameter a structure whose key corresponds to the name of one of the functional option parameters, and whose value corresponds to the value of the parameter. Calling the above methods will automatically update the corresponding part of the interface.

The parameters do not have to be specified all at once; you can change the value of a specific parameter or set of parameters selectively. But it is the group setting of values ​​with one call that is more effective.

To obtain parameter values, you need to call the corresponding function (GetInterfaceFunctionalOptionParameters() or GetFormFunctionalOptionParameters()), which will return the set parameters in the form of a structure, where the parameter name will be the key.

Object 1c "Functional options" - are intended to highlight functionality in an application solution that can be turned on (off) during implementation without changing itself (together with Subsystems they form an interface thin client 1C). They are part of the functional options mechanism.

Functional options mechanism includes two metadata objects:

  1. Functional option;
  2. Functional options parameters.

More details

Functional option represents a metadata object that can directly influence the composition of the application interface (if the functional option stores its value in a Boolean attribute). Using objects of this type, you can hide elements that are related to unavailable functionality. For example, the Currency accounting option can hide Currencies, the Currency from field, and the Currency amount column from reports.

The source of the value of a functional option is the metadata object selected as the Storage property, for example it could be .

If the value of a functional option is stored in a directory attribute or resource, additional information is required that indicates exactly how to select the option value. For this purpose, a separate metadata object is provided - Functional Options Parameters.

We can say that the parameters of functional options are the coordinate axes of the value space of functional options. Moreover, one parameter of functional options can determine the value of “its” coordinate axis simultaneously for many functional options.

[collapse]

Functional options may have an impact:

  1. to the user interface:
    • global ;
    • details (including columns of form details like Table of Values or ValueTree);
    • form commands;
  2. on reports implemented using a data composition system;
  3. to algorithms written in a built-in language - it is possible to obtain the values ​​of functional options from the built-in language and use them in various conditions, for example, to reduce the amount of calculations (see, for example,).

ATTENTION! If the client application works with the file version of the infobase via the web server, then changing the functional option will change the user interface only after restarting the web server (restarting the client application will not change the user interface).

Properties of Functional Options 1C

  • Storage is a field in which you need to select an object of type Boolean. Typically, constants are used.
  • when receiving - the flag is responsible for the ability to receive the value of a functional option in privileged mode.
  • Composition - a list of objects and object details, the visibility of which is turned on/off when a functional option is turned on/off (will be controlled using a managed form).

For example, depending on the conditions of a particular implementation, it is possible to disable the accounting of goods by warehouse so that when registering documents for goods receipt, the Warehouse field is not displayed in the document form.

Features of using 1C Functional Options:

  1. Functional options can have values ​​of any type (not necessarily Boolean).
  2. When adding a new constant to use a function option, be sure to include it in the appropriate subsystem and assign permissions to it.
  3. Working with functional options is available from the built-in language, thanks to which the developer can create his own algorithms for the values ​​of functional options.
  4. The command interface command will be excluded from the command interface if the functional option is disabled:
    • an attribute that is a command parameter;
    • command parameter type (if the command parameter type is compound, then the command becomes unavailable when all parameter types are disabled).

ATTENTION! Functional options and their parameters do not affect the composition of the database: all tables and fields are present in the database regardless of the state of the functional options.

Influence of functional options on form details and commands:

  1. managed form type<Вид>An object ( DirectoryObject, DocumentObject, etc.) will be disabled if the corresponding object is disabled by the functional option. Only those functional options that do not have parameters are analyzed.
  2. Basic attributes of a managed form type DynamicList will be disabled if the functional option disables the configuration object that is specified as the main table of the dynamic list. Only those functional options that do not have parameters are analyzed.
  3. The form attribute of a reference type is disabled if the configuration object that forms this type is disabled by a functional option. The form attribute of a composite type is disabled if the functional options disable all constituent types.
  4. A form table will be disabled if it displays form attribute data that is disabled by a functional option.
  5. There are no types in the type selection dialog (for example, for input fields associated with attributes of a complex type) if the configuration objects that form these types are disabled by a functional option. Information about types disabled by functional options is cached on the client side and cleared after 20 minutes or during a method call UpdateInterface().

ATTENTION! Unlike the command interface, the values ​​of the functional options parameters are set only for a specific instance of the form.

Creating a Functional Options Parameter

A functional option parameter is created using the 1C configuration object "Functional Option Parameters".

[collapse]

This can be done in the configuration window by adding a new object.

Functional options parameter properties:

  • Usage - sets up a set of objects whose values ​​will determine how the value of a functional option should be selected. The list of available objects includes directories and information register dimensions. For each functional options parameter in this list, you can select one directory (from the entire list of directories) and one dimension of each information register.

ATTENTION! You cannot use the same metadata object in multiple function option parameters.

Functional options are common configuration objects. They are part of the functional options mechanism and allow you to select functionality in an application solution that can be turned on/off during implementation without changing the application solution itself.

For example, depending on the conditions of a specific implementation, it is necessary to disable the accounting of goods by warehouses. So that when preparing documents for receipt of goods, the field Stock was not displayed in the document form.

For this purpose, a functional option can be defined in the configuration Warehouse accounting, stored in a type constant Boolean.

Various configuration objects or their details can be associated with this functional option. For example, you can associate the attribute with this functional option Stock document Receipt of goods.

Then, during implementation, you can enable or disable this functional option in a specific infobase in 1C:Enterprise mode.

The platform will automatically turn on and off the display of all relevant interface elements (fields, commands, list columns, report elements). In our case, the field will be hidden or displayed Stock in all document forms Receipt of goods.

Publications on the topic