Configuration extensions. Useful Tips for Development

In this article, I propose to consider what a "configuration extension" is, how to add an extension or disable it. Starting from version 1C On 8.3.6.1977 a new mechanism was introduced in the platform - configuration extensions. First, a little theory.

Extensions in 1C are something like parallel configurations that are automatically merged with the main vendor configuration. Moreover, in extensions, you can add both your own objects and borrow objects from the main configuration.

What are extensions for?

First of all, extensions are created to make it easier to make changes to the program. That is, if users ask to add some functionality, then before the advent of extensions, programmers had to remove the configuration from full support and change the typical configuration.

Removing from full support entails a number of inconveniences:

  • the possibility of automatic updating disappears, which leads at least to an increase in the time for ;
  • a highly qualified specialist serving the program is required;
  • if changes were made to standard objects of a typical configuration, then during the update they may disappear, that is, they can be replaced again with standard ones from the supplier.

When using extensions, when making changes, the programmer will not touch the standard configuration. All changes will be made using extensions, which (as I wrote above) are also configurations. Thus, the main configuration will remain at full support.

After updating the main configuration, if there are any changes in the new release with an object that was previously modified by the extension, then the changes will still be taken from the extension. That is, extensions take precedence over the main configuration.

Video - extensions in 1C in 45 minutes

Get 267 1C video lessons for free:

An example of adding an extension to 1C

To show what an extension is, it is better to give an example of its creation in the 1C configurator.

In the configurator, go to the "Configuration" menu and select the "Configuration extensions" item. A window will open with a list of extensions (if any). Click the "Add" button and add a new extension. Now you can open the extension configuration:

As you can see, the extension configuration has exactly the same structure as the main one. Only it is initially completely pure, without objects.

I recently wrote an article on how to make your own. Using her example, I want to make it inline using an extension.

In processing, I have a field with a link to the "Organizations" directory. That's why I need this guide. But we won't create new guide“Organizations”, especially since the platform will not allow this. You cannot have objects in the extension configuration that have the same name as objects in the main configuration.

Therefore, we will borrow the directory from the main configuration:

Now we will right-click on "Processing" and select "Insert external processing, report ..." Thus, we will add a new processing to the extension configuration. If you use my processing, then immediately rename it, since the main configuration already has a processing with that name.

Well, the final touch. I want my processing to be reflected in the "Administration" menu. To do this, we will borrow the subsystem of the main configuration of the same name. Do not forget to indicate in the processing that it belongs to this subsystem.

This is the structure I got:

Let's see what we got. We update the database configuration and run the program in 1C: Enterprise mode, and go to the "Administration" menu. Yes, I almost forgot, the extension configuration must be closed, otherwise the program will not start:

Implemented in version 8.3.6.1977.

We have implemented a fundamentally new mechanism for adapting applied solutions to a specific consumer - the extension mechanism.

Why are extensions good?

Extensions offer a different strategy than the existing one for changing typical configurations. Using this new strategy will greatly facilitate the maintenance of standard solutions that you want to adapt to the needs of a specific implementation, a specific customer.

What does this process look like now? There is a typical configuration. It is under full vendor support. This means that it cannot be changed. Periodically, the vendor releases new (improved) versions of this configuration. In such a situation, updating the old version of the configuration to the new version is performed completely automatically. It is convenient and does not require any special skills or knowledge from the customer.

But often the customer wants to add something or change something in a typical configuration “for himself”. To do this, the support mode is changed, the configuration is removed from full support. The implementation partner or the customer's own IT specialists make the necessary changes to it. From this point on, a fully automatic update of the typical configuration to the new version released by the supplier becomes impossible.

Now, updating the configuration requires the participation of a specialist. Moreover, if the changes made at the will of the customer were significant, then the specialist performing the configuration update may also require significant time. And often very good knowledge of both the typical configuration itself and the modifications made may be required.

The strategy offered by the extensions is as follows. If you want to change the typical configuration, you don't touch the configuration itself. All changes you make in the extension, which, in fact, is also a configuration.

In 1C:Enterprise mode, you simply connect your extension to the standard configuration. The platform automatically, in 1C:Enterprise mode, combines your extension with a typical configuration. As a result, the customer works with a modified, according to his wishes, standard solution.

When a vendor releases a new version of the common configuration, an automatic update is performed because the type configuration support mode has not changed. She remained at the full support of the supplier. And when you launch an updated application solution, the platform will again automatically merge the changed typical configuration with your extension. And the customer will continue to work with a modified, according to his wishes, standard solution.

When should you use extensions?

The extension mechanism is tempting due to its versatility. Therefore, it is important to have a correct idea of ​​what tasks it is intended to solve.

Firstly, extensions are indispensable when the applied solution works in data sharing mode. For example, in the service model. One of the subscribers wants to have a couple of additional reports. While other subscribers want to work with an unchanged standard configuration.

Then it is for this subscriber that you can develop an extension in which to realize all his wishes. The subscriber will connect this extension to himself and will work with the changed configuration. While for other subscribers no changes will occur. Because all extensions are connected and launched in the context of the current separator values.

Another situation is the completion of a typical configuration for a specific customer at his implementation. Or improvements to the standard configuration, which are performed for themselves by the customer's IT specialists on their own. If all these improvements are made in the extension, then the typical configuration will remain fully supported, which will greatly simplify its further maintenance.

There is a temptation to use extensions to create replicated application solutions, but you should not do this. Firstly, because the extensions were not designed for such tasks. And secondly, because other platform mechanisms, such as delivery and support mechanisms, do not know anything about extensions.

If you look a little into the history of the emergence of extensions, then, of course, we have seen before, and we see now, that configurations are becoming more complex. We see that more support is needed on different levels developments: library, modular and industry, etc. We analyzed all these tasks and came to the conclusion that the highest priority at the moment is the adaptation of configurations to the wishes of users during implementations.

It is for this task that we created the extension mechanism. Of course, in it you can notice different features of the other listed areas of development. But they are not its main purpose and should not confuse you.

What can be changed already now with the help of extensions?

So far, not much has been done of what is planned to be done. The mechanism, of course, will evolve. But what has already been done can be useful in many cases in implementations. Now:

  • Can be changed managed forms, existing in a typical configuration;
  • You can add new subsystems. You can change the composition of subsystems available in a typical configuration;
  • Can be changed roles a typical configuration by adding objects created in the extension to them;
  • Can be changed command interface typical configuration (main partition, subsystems);
  • You can add new reports And processing.

In the future, we plan to gradually increase the functionality of the extensions and will be happy to get your opinion on which functionality is most in demand for implementations with minor modifications.

How is the extension structured?

The extension is very similar to the normal configuration. It is also represented as a tree of objects. To work with the extension, the same methods of work are used as with the usual configuration.

An important feature of the extension is the presence borrowed objects. You can borrow any object of a typical configuration using the context menu command:

Borrowed objects are not always needed. The best way to explain this is with a “household” example, if we draw an analogy with lunch in a restaurant.

The first situation is when borrowed objects are needed.

You are used to having lunch at the same restaurant. You always order steak and tea. For example, because they are very good in this restaurant. Or for some other reason. It doesn't matter. The only important thing is that you are going to eat them, and nothing else.

Then the restaurant is a typical information base. You are an extension. The restaurant menu is an extensible standard configuration. Beefsteak and tea are borrowed objects. You borrowed them (remember they are on the menu).

How does the extension connect to the configuration and work? You go to a restaurant and ask for a menu. On the menu you see that there is a steak and tea. That is, you establish a correspondence between borrowed objects and objects of a typical configuration. Naturally, you match by name :). They bring you a steak and tea, you eat them. That is, the extension is connected and working.

A week later you come, but the restaurant menu has changed (the standard configuration has been updated). However, the menu still includes steak and tea. They are exactly what you need. They bring them to you, you eat them. That is, the extension continues to work with the updated typical configuration.

A week later, you come to a restaurant and see that the steak and tea have disappeared from the menu. You get up and leave (extension connection error message). Because you wanted them. And you have no idea about other dishes (objects). The developer did not teach you how to eat snails or lobsters properly.

Another situation where you can do without borrowed objects.

You go to a restaurant, but you are not interested in the availability of specific dishes. Because you're not going to eat them anyway. You only want to photograph them. And you know how to photograph any dish. Then you just hook into the config and say bring whatever snacks you have on the menu (get the collection of documents from the metadata). I will send them (take pictures).

If you describe this in the dry language of developers, it turns out that you need to borrow objects:

  • When they are needed for visual design. For example, you extend a form and add form props like ReferenceCurrency.Link. Then of course you should borrow a handbook Currencies, so that when connecting to a typical configuration, you can be sure that such a directory still exists in it.
  • When they are needed for the code to work. For example, in the extension code, you refer to the reference attribute Nomenclature - Importer. Then this attribute must also be borrowed in order to be sure when connecting that in the typical configuration such an attribute still exists in the directory Nomenclature.

Connecting an extension

You create an extension in the configurator. After it is debugged and tested, you can reject it by saving the extension to a *.cfe file.

You can send this file to the customer. The customer will independently upload it to his infobase in 1C:Enterprise mode using the standard function Managing configuration extensions.

Working with extensions is available from the built-in language, so in the applied solution you can create your own processing that will load extensions. To prevent everyone from “playing around” with extensions, we added a new right - Administering configuration extensions.

When loading an extension from a file, it is stored in the infobase. Moreover, it is saved in the context of the current values ​​of the separators used in this session.

For the extension to "work", the session must be restarted. At session start, just before the event is called SettingSessionParameters, all extensions stored in the infobase and corresponding to the current session delimiter values ​​will be included.

As a result, when working in data sharing mode, the extension will be applied only to users of this particular subscriber. And if data separation is not used, then the extension will work for all users of the infobase.

When connecting an extension, as we have already said, it is controlled that there are borrowed objects in a typical configuration. Objects are matched by name.

In addition, finer control is also possible. You can control not only the very existence of objects, but also the state of their individual properties. That is, if you think about a restaurant and a steak, it may be important for you not just the presence of a somehow cooked steak, but precisely the fact that here it is cooked uncooked, “with blood”.

Returning to the extension, by default it does not control the properties of borrowed objects. But if you need to, you can make some properties controllable. For example, it is important for your algorithm that not only there is a directory Nomenclature, but also that its code is of type Line.

Then if in a typical configuration the supplier changes the code type of this directory to Number, your extension will detect this at connection time and report an error.

An interesting point is related to the renaming of typical configuration objects. For example, you came to a restaurant, and instead of the menu Steak written Steak. That is, when connecting to the configuration, the extension does not find a directory in it. Nomenclature, because the vendor renamed it to Goods.

Now this situation is not a problem for you. And you don't have to "shovel" all the extension code so that instead of Nomenclature write Goods. Works and. So you just need to change the name of the borrowed object to Goods, and the platform will make the rest of the changes in the extension itself. Or with your minimal help.

Expansion work

You can talk for a long time about the features of the extension of different objects, about the features of the work of the extensions themselves. But we are limited by the scope of the review article, so we will only touch on the key and most revealing points.

The main "charm" of extensions is, of course, not that you can add something to the typical configuration that is not in it. And the fact that in the extension you can change what is already in the typical configuration. That is, you can change the properties of borrowed objects.

The basic concept used when configuration and extension work together can be described as follows. In those places where they "do not intersect", the extension complements the configuration. In those places where they "intersect" - the extension is applied.

You can see this in more detail on the example of managed forms. You can borrow a form from the main configuration and edit it in the extension without restrictions. For the visual part of the form and for its module, two different merging strategies are used.

The visual part of the form is fixed in the extension at the moment it is borrowed. And in 1C:Enterprise mode, for each form element, changes are analyzed relative to this state in the standard configuration and in the extension.

If there were no changes, or they were only in the typical configuration, the value from the typical configuration is applied. Otherwise, the value from the extension is used.

Thus, if you added a new command to the form in the extension, you will see it along with the rest of the form commands. And if you changed the title of an existing group, then you will see your title even if the vendor changes the title of this group in a typical configuration.

Form modules take a different approach. For a borrowed form, the extension creates its own module with its own handlers for all events. In 1C:Enterprise mode, both form modules (from the standard configuration and from the extension) are combined in one context. For this reason, each extension has its own prefix, which is added to the handlers of all events in the form module. So that there are no matches with handlers from the typical configuration. After that, event and command handlers are called sequentially and synchronously. First, the handler from the extension. Then from the typical configuration. You can change this sequence, or completely prohibit the execution of the handler from the typical configuration.

In general, with regard to the joint work of the configuration and extension in the 1C:Enterprise mode, they exist in a common namespace. This applies not only to individual modules, but also to the metadata trees themselves. Therefore, there is no way in 1C:Enterprise mode to determine whether this object is "native" for a typical configuration, or whether it came from an extension.

As for the rest of the objects that you can use in the extension, everything looks much simpler for them.

In the extension, you can create your own subsystems. Using borrowed objects, you can extend existing subsystems: add to them objects and subsystems that are already in the standard configuration, or those that you created in the extension. You cannot remove something from an existing subsystem.

You can only extend roles by adding objects created in the extension to them. You can't remove anything from an existing role either. The same applies to the command interface.

An extension is almost a configuration

We said at the beginning that an extension is similar to a regular configuration. Therefore, in conclusion, I would like to say a few words about how extensions are integrated with other platform mechanisms.

An extension (like a normal configuration) has a main configuration and a database configuration. The mechanism for comparing and merging configurations works with extensions in the same way as with regular configurations.

You can unload the extension to a file (however, with a different *.cfe extension), and load from a file. Extensions can be unloaded / loaded in XML.

Mechanisms global search, replacement, text editing interfaces also work with extensions.

There are new options command line to work with extensions, as well as new events in the log.

In the built-in language, the main object for working with extensions is Extension Manager Configuration.

Turned out to be very relevant :)

Ok, let's make this weekend useful too.

So, today another topic of “applied operation 1C”:

Extension mechanism in platform 8.3.6

What are we talking about?

In platform 8.3.6, a new mechanism was implemented - extension mechanism that facilitates the adaptation of the application solution for a specific customer.

When using extensions configuration is finalized in a new entity– configuration extension:

  • The extension, in fact, is also a configuration, but with some restrictions
  • The prepared extension can be connected to the customer's working database in user mode
  • The most important - the finalized configuration does not need to be removed from support, i.e. it remains standard, unchanged
  • Updating the modified configuration can be performed automatically by the user

Thus, the customer as a result receives possibility of improvement configuration and at the same time simple automatic update.

So that you can deal with this in more detail, we publish a few more videos + PDF on extensions.

So let's go:

Assigning configuration extensions

The video covers the new configuration extensions mechanism introduced in the 8.3.6 platform. It is intended for refinement, adaptation of solutions during implementation. At the same time, the customer receives a simple automatic configuration update and the ability to make improvements.

Objects that can be modified in an extension

This video discusses the existing limitations of the extension mechanism. Currently, only a limited number of objects can be used in extensions.

Working with extensions in the configurator

This video covers the development of extensions in the configurator. The extension is a configuration, although somewhat limited. Working with the extension is also performed in the tree of metadata objects. The resulting extension can be saved to a file on disk.

Borrowing objects

This video looks at borrowing basic configuration objects into an extension. This is the main mechanism needed to carry out the development of the extension itself. It also talks about controlled properties, the value of which is checked when the extension is connected.

Creating Your Own Objects in the Configuration Extension

This video shows how you can create your own objects in the extension. The list of such objects is still limited - these are reports, processing and subsystems. The development of such objects in the extension is carried out by analogy with the main configuration.

Working with extensions in user mode

This video shows how to connect a prepared extension to working base customer. In this case, the connection can be made from the user mode without accessing the configurator.

Working with Managed Forms in Configuration Extensions

This video walks you through how to work with managed forms in the extension. It is noted that the original form is not automatically synchronized with the extension. Explains how the system generates the resulting appearance of the form in the presence of an extension.

Managed Form Module and Event Handlers in Configuration Extensions

This video walks you through how to work with event handlers in Managed Configuration Extension Forms.

The order of execution of event handlers in the main configuration and in the extension is demonstrated.

0. Introduction

The configuration extension mechanism appeared in the 8.3.6 platform and, accordingly, can be used in configurations with disabled compatibility. Currently, all standard configurations on managed forms support working with extensions. Let's take a closer look at what this mechanism is.

According to documentation:

"The configuration extension mechanism is a special mechanism designed to refine an extensible configuration without changing this configuration (including without removing it from support).

The main purpose of the configuration extension is to refine the applied solution during implementation (or in the "cloud") to the needs of the client. At the same time, the finalized configuration does not need to be removed from support. As a result, it is easy to update a typical application solution that is under support, with the need to perform improvements. When developing an extension, you should understand some features of the functioning of the configuration extension. Thus, an extensible configuration can be changed at any time, for example, as a result of an update. At the same time, the extension developer cannot influence the possibility or impossibility of updating in any way. You should also consider the fact that more than one extension can function in the system and the author of each extension (in general) does not know how the other extension functions.

You can read more about extensions and see here:

Notes in the Looking Glass
Courses of Gilev and Nasipov
Extensions in 8.3.9

Below I will provide useful tips for working with extensions.

Some may seem too simple or obvious, but they can be useful for those who are just getting started with extensions.
I will also gladly add your advice from the comments.

So let's go!

1. Show/hide unchanged objects

As you add new objects, related objects are automatically added to the extension as well. As a result, many service objects accumulate in the extension metadata.
In order to show only changed objects there is a button “Changed and added in the extension”. When clicked, only manually added and modified extension objects are displayed.
Its working principle is shown below:

2. Sequence of execution of handlers

If you redefine an event or command in an extension, then by default the handler from the extension is executed first, and then the typical configuration handler.
This is not always convenient, for example, when some operations should be performed after standard handlers.
Consider examples that allow you to change this sequence:

a) Run the generic code first, then the code from the extension:

&AtServerProcedureTraining_WhenCreatedAtServer(Failure, StandardProcessing) AdditionalParameters = New Structure; AdditionalParameters.Insert("Message", "After GenericHandler!"); SetRunAfterEventHandlers("RunAfterTypicalHandler", AdditionalParameters); EndProcedure &AtServer Procedure ExecuteAfterTypicalHandler(Failure, StandardProcessing, AdditionalParameters) Report(AdditionalParameters.Message); EndProcedure

b) Execute first the code from the extension, then the type code, then again the code from the extension

&AtServer ProcedureInCreateTeachOnServer(Failure, StandardProcessing) // Procedures to generic handlers Report("To generic handler!"); // Set the handler after the default event handler SetExecutionAfterEventHandlers("ExecuteAfterTypeHandler"); // Next, the code from the type handler will be executed EndProcedure &AtServer Procedure ExecuteAfterTypicalHandler(Failure, StandardProcessing, AdditionalParameters) // Code after the typed handler from the extension Report("After the typed handler!"); EndProcedure

c) Execute type code first, then code from extension, then type code again

You can resort to tricks:
- We cancel the execution of handlers from the typical configuration.
- In the extension, we call the necessary procedures from the standard code mixed with procedures from the extension.

&AtServer ProcedureInCreateInServer(Failure, StandardProcessing) // Procedures to Generic Handlers Report("Before GenericHandler!"); // Procedures from a typical handler If NOT ValueFilled(BankAccount.CurrencyCash) Then BankAccount.CurrencyCash = General PurposeBPCallServerRetryUse.GetRegulatedAccountingCurrency(); EndIf; PlaceContactInformation(); If Parameters.Key.Empty() Then PrepareFormOnServer(); EndIf; FormControl(ThisForm); // Procedures after generic handlers Report("After GenericHandler!"); // Stop execution of generic handlers SetExecuteEventHandlers(False); EndProcedure

d) Cancel generic handlers

&AtServer ProcedureTraining_WhenCreatedAtServer(Failure, StandardProcessing) // Stop execution of typical handlers SetExecuteEventHandlers(False); EndProcedure

3. Create and use a shared module, manager module, or object module

Currently, the extension mechanism does not allow the creation or borrowing of shared modules, manager modules, and object modules. But in the processing included in the configuration, the manager module is available and can be accessed:

&AtServer Procedure NotifyDirectorAtServer() Position = "Director"; Full name of the head = "Ivanov I.I."; Processing.Study_Processing.Notify the Director(Position, full name of the Head); EndProcedure

Processing manager module:

Procedure NotifyDirector(Value Position, Value Head Full Name) Export MessageText = StrTemplate(НStr("ru="%1 %2""), Position, FullName); Notify(MessageText); EndProcedure

In the same way, you can organize your own similarity to a common module in which you can store general procedures and features required for the extension to work, . Can also be included in an extension external processing. Let me remind you that the manager module is not available in external processing.

4. How to connect debugging

In typical configurations based on the library of standard subsystems (BSP), when debugging extensions, the following terrible message is encountered:


It occurs if our extension is open in the configurator and is treated only by closing the extension window.

In order to enable debugging in the extension, you should alsouse the command line switch - “Debug Mode”

This is Y forgiving code debugging. In particular:

  • All long-running operations are performed immediately, without running a background job;
  • When developing configuration extensions, it is possible to launch with installed configuration extensions that are currently open in the configurator (provided that the configuration version and extension versions have not changed).

To install it:

  • Run enterprises with command line switch - "/C Debug Mode"
  • In the configurator mode, set the launch parameter:
    Tools -> Options -> Launch 1C:Enterprise -> Launch option: enter a string< Debug Mode>

When you connect an extension for the first time, or if there is a change in the version of the extension or provider, debugging may fail to connect with the same message.

In order to correct this situation, you can try the following steps:

1. Close this extension in the configurator
2. Run the configuration in enterprise mode and open the form associated with the extension
3. Open the extension in the configurator
4. Restart debugging.

5. How to write requests

The extension sees and works only with those objects that are borrowed from the main configuration.
Objects that are not borrowed are not visible in the extension and when you try to access them, for example, in the request text, in the “Configurator” mode, they cause an error. Although in user mode, the code runs without problems.
In order to write or edit queries with a large amount of metadata, it is better to use any external processing. All metadata from the main configuration is available in it:


6. How to save data

The extension is not designed to store important data, let alone data that affects accounting. But the settings need to be saved.
To do this, you can use the storage of general settings or saving form data:

a) Saving form data

In the edited form, you can set the property - “AutoSaveDataInSettings” to "Use" and put the "Save" flag over the required details. This will save attribute values model mechanism platforms:


This data storage .

b) Storage of general settings

Any data can be stored in this storage. More details can be.
Consider an example of storing arbitrary data.

Data saving:

&OnServer Procedure BeforeClosingOnServer() // Prepare data storage structureSettingsStructure = New Structure; StructureSettings.Insert("All", All); StructureSettings.Insert("Close", Close); StructureSettings.Insert("To Friends", To Friends); // Save the data in the general settings storage General Purpose. General Settings Storage EndProcedure

Data recovery:

&AtServer Procedure OnCreateAtServer(Failure, StandardProcessing) // Initialize the StructureSettingsStructure = New Structure; // Restore the saved dataSettingsStructure = GeneralPurpose.GeneralSettingsStorageLoad("Study_MakeAllGood", "Settings", SettingsStructure); // Fill in the values ​​of the form attributes FillPropertyValues(ThisForm, SettingsStructure); EndProcedure

7. How to add your layout

Unfortunately, you can't add or change layouts in borrowed documents. But layouts can be added to treatments, and you can also insert external treatments that already have layouts. These layouts can be used to create or modify printables, .

8. How to replace the fill button of the tabular section

Sometimes you may need to add your own fill button and leave the standard button.
In order to remove a typical button away, but not delete it completely, you can set the property - “Only in all actions” - "Yes":

In this case, the button will be available from the "More" submenu. This will allow you to continue working with standard functionality in case of unforeseen situations.

9. Extension as a bugfix

There are situations when the client has an error, but the configuration is locked. I do not want to remove from support for the sake of fixing the error. In such situations, it is possible to create a small extension that fixes this particular error. Having created such an extension once, you can easily connect it to all your clients.

In addition, typical developers sometimes post the text of the error correction on the partner forum. This will make creating such an extension even easier.

If the error is not easy to fix, then you can make it at least less critical, for example, by putting a stub in the problem area.

And do not forget to disable this extension after the error is fixed in the typical configuration.

10. How to bring your processing to the interface

In order to bring your processing to the configuration interface, you must include it in the required subsystem:

You can also create your own subsystem in the extension and put the necessary objects into it.
For example, you can put external processing or reports in the extension and simply connect them to any configuration:

11. How to transfer the extension to 8.3.8

To transfer the extension to 8.3.8, do the following:

1. Remove the compatibility mode in the extension.
Set the compatibility properties to be the same as the main configuration.

2. Fix connectivity issues.
It is necessary to check that the new version extension is connected. The cause of the errors can be viewed in the log.

3. Update the forms in the extension.
You should update the extension forms from the main configuration. So that both in the extension and in the configuration of the form are the same.

4. Bring the layout of the form to the new rules of the engine.
Guidelines for adapting forms to the new platform can be found at this link.

5. Check that the extension looks and works correctly.

More details on each item are described in. There are also given useful materials on this topic.

12. How to connect the extension

1. Administration - "Printing forms and processing"

3. Button "Add" - Select a file

4. "Restart" button

5. Done!


13. How to update the extension

1. Administration - "Printing forms and processing"

3. We get up on the desired extension

4. "More" - Command "Update from file on disk"

5. "Restart" button

6. Done!

For now, that's all!

Gratitude can be expressed in money, and then the crisis, you know!

Having studied the experience of using previous versions of the program, and taking into account the fact that no matter how universal and comprehensive a particular solution is, in the end, in 90% of cases, it needs to be finalized for the end user. The developers of version 8 of the 1C program implemented several fundamentally new solutions to minimize the need to change standard configuration mechanisms:

  • Literally from the first versions of the program, the elements of many directories have the opportunity to create additional properties and categories using the corresponding plan of characteristic types and information register;
  • Additional printed forms and forms for filling in tabular parts, as well as additional reports and processing can now be called from the corresponding directory;
  • Processing of standard procedures of objects is carried out not by making changes to the module, but by subscribing to events;
  • And, finally, from platform version 8.3.6, configuration extensions appeared in 1C.

What are 1C configuration extensions, how to work with them, restrictions on use - this is the range of issues that we will try to reveal in our article.

A bit of theory

Before the advent of the extension mechanism, the process of updating typical configurations in to a large extent depended on whether the configuration is in support or has been changed. In the latter case, the developer had to:

  1. Compare typical and existing metadata structure;
  2. In case of a significant difference between typical elements, follow the correct update;
  3. Make appropriate changes after the update.

All this greatly complicated the update process, increasing the development time and, often, deprived the organization of the opportunity to update typical modules of expensive software.

The extension mechanism allows you to modify many of its elements without removing the standard configuration from support. In fact, the developer, based on a typical solution, creates his own configuration, which is a shell for a typical solution. In this case, the process of updating the typical part occurs automatically, while when launched by the end user, the platform combines both solutions for the user.

Situations where extensions can be used

Like any other tool, the extension mechanism has a number of characteristics and limitations that determine the scope of their use:

  • Extensions can work with managed forms;
  • The mechanism supports changing and adding existing subsystems;
  • Before the release of platform 8.3.8, it was only possible to change existing roles in the extension, after the update they allowed adding new ones, restricting access even to the objects of the main database;
  • The existing mechanism allows own will change the command interface of subsystems and the main configuration section;
  • Also, this toolkit allows you to add processing and reports without making changes to the database structure;
  • In the platform version 8.3.9.718, the mechanism for diagnosing the compatibility of the extension and the main configuration has been significantly redesigned.

From the above, it becomes clear that:

  1. When working with regular forms, the functionality of extensions is significantly limited;
  2. Although the process of updating the main configuration has been facilitated, the possibility of using a specific extension (including as a circulation solution) can be seriously limited both by changes in the original structure and by several extensions used in parallel;
  3. It is advisable to use this mechanism in cases where there is a need for differentiation appearance and functionality used by various users, or when a standard configuration that is under support is being finalized on its own.

Let's move on to practice. As an initial base, we will use the configuration "Salary and personnel management" version 3.1.3.223, the work will be carried out on the platform 8.3.10.2561, the work mode is file.

Create an extension

In the configurator, enter the menu Configuration->Configuration extensions, a form will open (Fig.1).

This is where you can create a new extension. Click the "Add" button. Here is the window of the new extension (Fig. 2)

Fig.2

Consider its elements:

  • Name - unlike other configuration elements, it is not created according to system standards, i.e. may start with a digit or symbol, may contain a space;
  • Synonym - just like for other metadata elements, it contains an expression-representation of an object;
  • Prefix - allows you to identify event handlers in the form module, since the main configuration form module and the extension form module are combined when the platform works in a common context (by default, the extension is processed first, that is, handlers with a prefix, then the main handlers);
  • Appointment.

The list of the "Destination" field consists of three values, we will describe them in the order of execution:

  1. Correction - extensions of this purpose are created to correct minor inaccuracies and errors in borrowed objects;
  2. Adaptation – the default value, extensions of this type are designed to adjust standard objects to the requirements of a particular user (if the extension was created in a version of the program below 8.3.9, after updating the platform it will have exactly this purpose);
  3. Addition - they bring a completely new functionality to the standard solution.

Launching an extension

Double click on the extension name in the window from Fig.1, opens the extension window (Fig.3)


As you can see, it is a tree similar to the main configuration tree. And here one question arises, in what cases should an object be borrowed?

It is necessary to borrow only those objects (dictionaries, documents, details, etc.) that will be used in the form extension, or in the code of its module, and without borrowing which an error may occur in the extension operation.

That is, if our development requires the requisite "TIN" of the directory " Individuals”, if it will be used in the form module, we must borrow it from the main database. In this case, each time the extension is launched, a check will be made for the presence of this attribute in the main configuration reference book and for the correspondence of the data type in the source database and in the extension.

If after the update or during the development of new functionality there is an inconsistency between the extension and configuration data types or some other errors, the system will inform the user about this (Fig. 4)

The window in the lower right corner indicates a non-standard situation when connecting the extension, double clicking on it opens detailed information. In this case, we simply changed the value type of the TIN attribute from the “String” value to the “Boolean” value for the borrowed object, but the reverse situation happens much more often - when updating a standard product leads to a change or elimination of the main database attribute.

Having worked out and tested the extension on a copy of the base, it can be uploaded to a separate file; for this, in the window (Fig. 5), you must click the "Configuration" button, select the "Save to file" item. Unlike regular configuration files that have the cf extension, the configuration add-on file will have a *.cfe mask.

As can be seen from the above figure, you can load new functionality from the same window, or from the main program window.

To connect the extension in 1C.Enterprise mode, the user must have the "All functions" mode enabled and the program must be logged in with Administrator rights.

The way to connect the refinement is as follows: All functions->Standard->Manage configuration extensions. The opening window is shown in Fig.6

Fig.6

Clicking on the "Add" button opens a file selection dialog in which you need to select our upload. If the processing is checked (Fig. 7) and the extension contains an error, the connection of the functionality will be canceled and the program will report an exception.

Fig.7

In order for our functionality to work after successful addition, the program must be restarted.

Borrowing objects and the order of firing modules

In order to trace the sequence of execution of the handlers, we will enable the ability to change our configuration and add a new processing to it, the functionality of which will consist of only one thing - it will report that it was launched from the main configuration, the code in Fig. 8.

Fig.8

Let's add this processing to the extension.

For this:

  • Right-click to activate the context menu of the processing form (Fig. 9);

Fig.9

  • Select the item "Add to extension";
  • The processing itself and a duplicate of its form will appear in the additional configuration tree;
  • Having opened the form, we find that the command that causes the message is also there, only it has not been assigned a handler;
  • Adding a command action brings up a dialog box (Fig. 10) in which, in addition to the main directives of the command execution site, there is also a Call Type group.

Fig.10

We have three types of call for the given procedure;

  • Call before – the execution of the extension code will be launched before the main configuration is completed;
  • Call after - the modified procedure will become the second number;
  • Call instead - the procedure from the main configuration will not be executed at all.

Let's leave the call type in the "Call after" position and add the procedure "Ext1_NotifyAfter(Command)" (Fig.11).

Fig.11

The result of starting our processing will be sequentially reported two phrases (Fig. 12), that is, an additional configuration message will be displayed after the main message. If we chose "Instead", we would not see the first line at all.

Fig.12

Starting from version 8.3.9.1818, the functionality of the program included a mechanism for changing standard modules, as well as adding custom modules. And here the developers faced a very specific task: how to determine in what order the borrowed procedures and functions should be executed not only in relation to the main configuration, but also in relation to the extensions already included in the configuration.

Annotation mechanism

Imagine a situation when several extensions are connected to one configuration, that is, the window for selecting them in the configurator looks like (Fig. 13)

Fig.13

When adding each new extension, the system independently builds the order of their execution.

The order of execution of additional modules is set based not only on the time the module was added (later added, later executed), but also based on the purpose of the revision (“Execution” will always come before “Adaptation”).

In addition, the sequence of execution of the procedures of the added modules can be controlled using annotations:

  • &Before("ProcedureName");
  • &After("ProcedureName");
  • &Instead("ProcedureName").

As you can see, their set is similar to what was demonstrated in the previous section, and the functionality is similar.

Since the borrowed module and the donor module are in the same namespace, no additional definitions for type variables and methods are needed in this case.

The situation with functions is somewhat different than with procedures. The fact is that the execution of a typical procedure can be, as it were, framed by an extension code, that is, you can insert some actions before the procedure code, some algorithms after, but for functions this will not work. If the main function is executed after the extension code, the return value of the replacing function will not be received, but if before the modified algorithm, the value of the main function will not be received and the &After annotation will work as &Instead.

To eliminate this "injustice", the ContinueCall() method was created.

Generally speaking, using the "Instead" annotation is a bit incorrect, although it is sometimes necessary. Using it, we largely limit the functionality that can be significantly changed and improved in standard configurations.

Making changes to the object module

The event subscription mechanism greatly facilitated the work of developers, but there was one serious BUT.

But to use it, you often had to create your own common module, which would store procedures for processing certain actions with data. At present, the use of extensions has made it possible to largely revise this functionality.

Suppose, in the process of work, we needed to add some kind of processing for standard document"Hiring" at the time of his appointment. Previously, we would go to subscriptions and act from there, now we can add this document to the extension:

  • Let's select "Hiring" in the configurator and add it to our extension from its context menu (by the way, this mechanism has a combination of hot keys Alt + Shift + F2);
  • After selecting the appropriate addition, we will get a picture, as in Fig.14;

Fig.14

  • We will be interested in the element “Object Module” highlighted in yellow, open it by first activating the corresponding checkmark (Fig. 15);

Fig.15

  • We will get a clean sheet of the program module, pay attention to the top panel, or rather, to the element shown in Fig. 16, in the drop-down list there are events that can be processed for this object;

Fig.16

  • Let's try to display the document number in the message when it is written by selecting the appropriate event;
  • We will receive a call type selection form (Fig.17), determine when the number will be displayed;

Fig.17

  • The procedure code is shown in Fig.18;

Fig.18

In some cases, due to the checked "Safe Mode" checkbox, the extension connects with an error.

Small announcement

In the near future, 1C plans to release platform 8.3.11, in which they announced the possibility of adding their own:

  • Documents;
  • directories;
  • Exchange plans;
  • information registers.

It should also be possible to add details and tabular parts. At the same time, the developers took into account the possibility of changing standard solutions, which may lead to a failure in the operation of the extension.

The data entered into the extension will not be lost, and until the compatibility problem is resolved, the main configuration directory modified by the extension will not be writable.