Views: 4750 (Data available since 06.02.2017)
Custom field - is a system functionality that permits adding fields that are not included in the standard functionality to system objects.
It is important to distinguis Custom Fields in system modules and properties used in infoblocks, although the term custom fields is used in system forms (a user set up/editing form, infoblock section set up/editing form, and others).
Custom fields is an entity:
- more multi-purposed, because the fields can be set up for various objects of the system compared to the infoblock properties,
- more limited in options because this entity admits a small number of data types.
An unlimited number of custom fields can be created for each object. When choosing any type of a custom field, additional setup fields become available for each chosen type.
The application of custom fields in the system to any module is set up using the objects which must be indicated when creating a field. Not all modules have objects for custom fields by default. A developer can create own objects taking into account that GetList methods support only system objects:
|Standard objects of customer fields
|Module ||Object ||Description |
|Kernel ||USER ||For a user |
|Blogs ||BLOG_BLOG ||For a blog |
|BLOG_POST||For a blog post |
|BLOG_COMMENT||For a blog comment |
|Tasks ||TASKS_TASK ||For tasks |
|Information blocks||IBLOCK_N_SECTION ||For infoblock sections with ID = N |
|IBLOCK_N ||For infoblock with ID = N |
|Calendars ||CALENDAR_EVENT ||For calendar events |
|e-Learning ||LEARN_ATTEMPT ||For test attempts |
|Social Network ||SONET_GROUP ||For groups of a social network |
|Document library ||WEBDAV ||For document libraries |
|Forum ||FORUM_MESSAGE ||For forum messages |
|Highload iblocks ||HLBLOCK_N ||For Highload iblock with ID=N |
Note: The modules using information blocks can work with objects of custom fields of the Information blocks module.
Custom fields can often be created on the page Control Panel >Settings > System settings > Custom fields or, preferable, using the link Add user property in the system forms which provide for the standard adding of custom properties:
- A form to add/edit a user;
- A form to add/edit a section of an information block;
- A form to add/edit a blog.
The page Custom fields can be used if the developer knows exactly which object type identifier they require.
Custom fields can be created with various data types. By default, the system provides for the following types:
- Bind to highload information block elements
- Link to information block sections
- Bind to Information block elements
- Bind to CRM elements
- Bind to CRM dictionaries
- Document from Library
- Link to Employee
- Revision history file in Document Library
Events can be used for working with custom fields.
Kernel module events used during work with custom fields:
|Event ||Is called ||Method |
|OnUserTypeBuildList ||When the list of custom fields is being built ||CUserTypeManager::GetUserType |
|OnUserTypeRightsCheck ||When verifying the rights of access to custom fields ||GetRights |
|OnAfterFetch ||When the list of custom fields is being built || |