How to get order fields in 1C?
I’m a beginner 1C user and I’ve encountered some difficulties. Please explain how to get fields with multiple selection in 1C.
Specifically, I’m creating an order and adding products. The product has a “price type” field. How can I get all possible price types for this product?
I’m also interested in how to get all order statuses. I understand that they are stored as an enumeration, but I don’t know how to access them.
In 1C for getting order fields, including multiple selection and enumerations, you need to use built-in configuration mechanisms. To get product price types, you need to refer to the product attribute and available prices, and for order statuses - to the corresponding enumeration through the program interface or built-in functions.
Contents
- Basic Concepts about Order Fields in 1C
- Working with Multiple Selection Fields
- Getting Price Types for Products
- Working with Order Status Enumerations
- Programmatic Data Access Examples
- Practical Recommendations for Beginners
Basic Concepts about Order Fields in 1C
In 1C, a customer order is the main document for recording customer intentions to purchase goods or services. The order structure includes attributes and a tabular section with products.
Main elements of an order:
- Attributes: number, date, customer, order status
- Tabular section: positions with products, quantities, prices
- Reference fields: price types, statuses, agreements
For beginner users, it’s important to understand that in 1C there are two types of fields:
- Simple fields (with a single value)
- Fields with multiple selection (when multiple options can be selected)
Important: Depending on the configuration (UNF, UT, ERP), the order structure and available fields may differ.
Working with Multiple Selection Fields
Multiple selection fields in 1C are implemented through special data types. There are various approaches to working with them:
1. Through the User Interface
For fields with multiple selection (for example, price types, statuses):
- Open the order form
- Go to the required tab or attribute
- Click the selection button (usually with ellipsis)
- In the opened list, check the required values
- Confirm the selection
2. Programmatic Value Retrieval
For programmatic access to multiple selection fields, use methods for working with value lists:
// Getting available price types for the product
Request = New Query;
Request.Text =
"SELECT
| ProductPriceTypes.Reference,
| ProductPriceTypes.Name
| FROM
| Catalog.ProductPriceTypes AS ProductPriceTypes
| WHERE
| ProductPriceTypes.IsGroup = FALSE";
Result = Request.Execute().Select();
This query will return all available price types in the database.
Getting Price Types for Products
Price types in 1C are stored in a special directory “Product Price Types”. To get available prices for a specific product:
1. Through Standard 1C Mechanisms
- Open the product card
- Go to the “Prices and Balances” section
- Select the required organization
- A list of active prices will open
2. Programmatic Price Retrieval
To get prices for a specific product, use the following approach:
// Getting prices for a specific product
Product = Catalogs.Products.FindByCode("000000001");
ContextDate = CurrentDate();
// Getting available price types
PriceRequest = New Query;
PriceRequest.Text =
"SELECT
| ProductPrices.PriceType.Name,
| ProductPrices.Price
| FROM
| InformationRegister.ProductPrices AS ProductPrices
| WHERE
| ProductPrices.Product = &Product
| AND ProductPrices.Period <= &ContextDate
| ORDER BY
| ProductPrices.Period DESC";
PriceRequest.SetParameter("Product", Product);
PriceRequest.SetParameter("ContextDate", ContextDate);
PriceResult = PriceRequest.Execute().Select();
This code will return all available prices for the specified product on the current date.
3. Working with Multiple Price Type Selection
If you need to get multiple price types at once:
// Getting multiple price types
AvailablePriceTypes = New ValueList;
// Adding specific price types
PriceType1 = Catalogs.PriceTypes.FindByName("Retail");
PriceType2 = Catalogs.PriceTypes.FindByName("Wholesale");
If PriceType1 <> Undefined Then
AvailablePriceTypes.Add(PriceType1);
EndIf;
If PriceType2 <> Undefined Then
AvailablePriceTypes.Add(PriceType2);
EndIf;
Working with Order Status Enumerations
Order statuses in 1C are usually stored as an enumeration. To get all available statuses:
1. Determining the Status Enumeration
The order status enumeration may be called:
- “Order States” (in UNF)
- “Order Statuses” (in other configurations)
- “DocumentStatuses” (universal option)
2. Getting All Enumeration Values
// Getting all order statuses
StatusEnumeration = Enumerations.OrderStates; // or other option
AllStatuses = StatusEnumeration.GetValues();
// Output all statuses to the debugger
For Each Status In AllStatuses Do
Message(Status + " - " + Status.Description);
EndDo;
3. Working with a Specific Status
// Finding a specific status
DesiredStatus = Enumerations.OrderStates.FindByIdentifier("InProgress");
If DesiredStatus <> Undefined Then
// Setting the order status
Order.Status = DesiredStatus;
Order.Write();
EndIf;
4. Available Statuses Depending on Configuration
According to research, 1C:UNF uses the following order states [source 1]:
- “New”
- “In progress”
- “Cancelled”
- “Ready for shipment”
- “Shipped”
In 1C:Trade Management, statuses may differ and depend on the order strategy [source 5].
Programmatic Data Access Examples
Complete Example of Getting an Order with Price Types and Statuses
Procedure GetOrderData(CustomerOrder)
// Getting main order fields
OrderNumber = CustomerOrder.Number;
OrderDate = CustomerOrder.Date;
Customer = CustomerOrder.Customer;
Status = CustomerOrder.Status;
// Getting the tabular section with products
OrderProducts = CustomerOrder.Products;
// Processing each order position
For Each ProductRow In OrderProducts Do
// Getting the product
Product = ProductRow.Product;
// Getting the price type for the position
PriceType = ProductRow.PriceType;
// Getting the position price
Price = ProductRow.Price;
// Forming information
Message("Product: " + Product);
Message("Price type: " + PriceType);
Message("Price: " + Price);
EndDo;
// Getting all possible order statuses
StatusEnumeration = Enumerations.OrderStates;
AllStatuses = StatusEnumeration.GetValues();
Message("Possible order statuses:");
For Each Status In AllStatuses Do
Message(" - " + Status);
EndDo;
EndProcedure
Example of Getting Available Price Types for an Organization
Function GetAvailablePriceTypes(Organization)
Result = New ValueList;
// Getting the organization's agreements
Agreements = Documents.CustomerOrder.FindByAttribute("Organization", Organization, True);
// Collecting unique price types
For Each Agreement In Agreements Do
For Each ProductRow In Agreement.Products Do
PriceType = ProductRow.PriceType;
If PriceType <> Undefined And Not Result.FindValue(PriceType) Then
Result.Add(PriceType);
EndIf;
EndDo;
EndDo;
Return Result;
EndFunction
Practical Recommendations for Beginners
1. Studying the Configuration Structure
Before working with orders, it’s recommended to:
- Study the “Products” directory and its attributes
- Check for the existence of the “Price Types” or “Product Price Types” directory
- Determine how status enumerations are named in your configuration
2. Using Built-in Reports
For price and status analysis, use standard reports:
- “Product Prices”
- “Customer Order Analysis”
- “Order Status Report”
3. Debugging and Testing
When programmatically accessing data:
- Use the debugger to check values
- Test on test data before applying in the working database
- Keep backups before mass changes
4. Referring to Documentation
For a specific configuration, study:
- The built-in help system (F1)
- User manual
- Technical documentation on the API
Tip: Start by working through the user interface to understand the data structure, then move on to programmatic access.
Sources
- How to create and manage orders in “1C:Retail” and “1C:UNF”
- Product prices in 1C - 1CGreen.ru
- “Customer Order” in 1C:Trade Management
- Product Price Types directory in 1C
- Customer order formation in 1C:Trade Management 8 ed.11.2
- 1C Enumerations - programmatic use | 1s-up.ru
- Customer orders in 1C:Trade Management 11
- Directories in 1C 8.3, 8.2 language (in examples)
Conclusion
Working with order fields in 1C, especially with multiple selection and enumerations, requires understanding the configuration data structure. The main points to remember:
- Multiple selection fields in 1C are implemented through value lists and special data types
- Price types for products are stored in directories and information registers, accessible through database queries
- Order statuses are usually presented as enumerations, which can be accessed through the 1C object model
- For beginners, it’s important to first study the structure through the user interface, then move on to programmatic access
It’s recommended to gradually master order operations: first simple filling operations, then analysis of existing data, and only then programmatic interaction. Don’t forget to use the built-in help and test all changes on test data before applying them in the working database.