Question: I have created my own catalog in the extension. How can I apply the built in additional attributes functionality to this catalog?
Answer: Let’s assume we are using 1C:Drive with an extension called “MyExtension” with name prefix “MyExt_”. We have already created the “MyExt_Catalog” in the extension and want to add additional attributes functionality to this catalog. Please follow those steps and it should work for you:
- Take to the extension functional option UseAdditionalAttributesAndInfo, constant UseAdditionalAttributesAndInfo, catalogs ObjectPropertyValueHierarchy, ObjectsPropertyValues, Users, chart of characteristic types AdditionalAttributesAndInfo. Take only the objects themselves, no need to take the attributes or tabular sections of the objects.
- Take to the extension ObjectKindByType method from the “Common” common module by using Around directive. Change the procedure in the extension as shown in the screenshot below.
- Add to our catalog in the extension a tabular section called “AdditionalAttributes”. This tabular section must have three fields: Property (ChartOfCharacteristicTypesRef.AdditionalAttributesAndInfo), Value (CatalogRef.ObjectsPropertiesValues, Boolean, CatalogRef.ObjectPropertyValueHierarchy, String, Date, Number, CatalogRef.Users), TextString (String, length = 0, open ended).
- Open the item form of our catalog, add to the form items “GroupAdditionalAttributes” group, Type = regular group, Representation = none, Group = vertical.
- Create OpenAdditionalAttributes command of the form, Action = OpenAdditionalAttributes, Functional options = UseAdditionalAttributesAndInfo. Place the command under the “GroupAdditionalAttributes” form item. Type of the form item of the command = Hyperlink.
- In the form module of our catalog, create the procedures and fill in the code as seen in the screenshot below.
- We have to add to the AdditionalAttributesAndInfoSets catalog a new predefined element which must be named as “Catalog_” + name of our catalog which we have created in the extension. Unfortunately, in order to achieve this, we have to allow modifications to the main configuration first. That’s because until version 8.3.20, extensions functionality of the 1C:Enterprise Platform did not support adding predefined elements to catalogs which reside in the main configuration, and the built in additional attributes functionality dictates that the AdditionalAttributesAndInfoSets catalog element must be predefined (creating it with via programming as not predefined won’t work). Also please note that as of version 1.3.15, 1C:Drive does not support 8.3.20 platform yet, so upgrading to 8.3.20 platform is not an option.
- We have added the needed predefined catalog element to the AdditionalAttributesAndInfoSets catalog, we still need to change it’s “Used” attribute value to True though. In order to achieve this, from the enterprise regime open Settings -> Application settings -> Support and service -> Data adjustment -> Bulk attribute editing. For the AdditionalAttributesAndInfoSets be shown in the items to edit field, we first have to activate the “Show service attributes” setting from the Additional parameters dialog. Afterwards, filter our predefined AdditionalAttributesAndInfoSets catalog element and change it’s “Used” attribute value to True.
- Now our catalog has appeared on the form. Add an additional attribute to our catalog and check if it is working correctly.