Scope: managed applications, mobile applications, and ordinary applications.
1.1. When developing a managed application, control the number of server procedure and function calls from the client code (server calls). In some cases, you also need to control the data being transferred between the client and the server (traffic).
The aggregate number of server calls includes the following:
Server calls made by 1C:Enterprise platform.
Calls made from the configuration client code (a deviation made by the configuration towards the platform).
Generally, when you design client/server interactions in the configuration, note that no single user action in the configuration client code must require additional server calls. Any exceptions must be reasonable.
1.2. For the slow connection mode, optimize both the number of calls and volume of data being transferred between the client and the server (traffic). We recommend that you debug client/server interactions in this mode in the mode of simulation of server call latency.
Below you can see standard user actions and recommendations for client/server interactions.
Starting client applications
We do not recommended that you call server procedures and functions directly from the application module code, managed application module, or external connection module.
Correct example: within a single server call transfer all parameters required to start an application.
If it is required to request client application startup parameters from the server from multiple client code locations, place this function in a common server module with repeated use of return values. If this function is called for the first time, a single server call is made. After that, the received value is automatically cached by the platform on the client for all repeated calls of this function.
// StandardSubsystemsOverridable common server module fragment with repeated use of return values
Parameters = New Structure();
// Initialization of other parameters required on the client to start the application
// Parameters.Insert(parameter name, parameter value);
Example of a client code that uses the ClientRunParameters function:
FileInfobase = StandardSubsystemsOverridable. ClientRunParameters().FileInfobase;
If FileInfobase Then
// This event processing in client code
Opening managed forms
3.1. If a form is opened from code, open it with a single call using the OpenForm global context method. If you use 1C:Enterprise 8.2 platform or earlier versions, you can also use OpenFormModal. To pass parameters to the form, use the Parameters parameter of these methods.
3.2. Whenever a form is opened, avoid server calls from the form module code in the form client event handlers, such as OnOpen and OnReopen. If you need to access server data from these handlers, place this data in the form attributes in OnCreateAtServer.
ProxyServerSetting = ServerModule.ProxyServerSetting();
OpenForm("CommonForm.ProxyServerParameters", New Structure("Settings", ProxyServerSetting));
Get the constant value in the OnCreateAtServer handler of the ProxyServerParameters form.
Executing local commands of managed forms
- If a command executes client operations only (opens a new form, sets a filter in a list, changes appearance, and so on), all the data required to execute the command must be preliminary passed to the client. We recommend that you prepare this data in advance in the OnCreateAtServer form event handler and place it in the form attributes.
When goods are selected from the list, it is required to restrict product group selection for users. Whenever a user attempts to select a product group, the application must display a warning. It is incorrect to call a separate server function to check whether the selected product item is a group. Add the IsFolder attribute to a value table related to a form list field. Fill in the attribute in the OnCreateAtServer form event handler. In this case, check on the client is performed without additional server call and is as follows:
CurrentRow = Item.CurrentData;
If CurrentRow.IsFolder Then
Message = New UserMessage();
Message.Text = NStr("en = "Group selection is restricted'");
- If a command is related to business logic, which can be processed on the server only, it must be executed within a single server call.
Selection from catalogs
Executing global commands
Executing report generation commands
In particular, when opening a report form, avoid server calls from the form module code in the form client event handlers, such as OnOpen and OnReopen.
For example, it is incorrect to generate a report that uses a data composition system from the OnOpen form handler:
// Code to generate the report…
- Open a report form with the GenerateOnOpen = True.
- Set the GenerateOnOpen form parameter to True in the OnCreateAtServer handler.
7.1. During client/server interaction upon selecting items, it might be required to pass the selected item list between the object form and the selection form. Data size to be passed can be rather large.
In this case, we do not recommend that you pass potentially large size of data as a selection form parameter. Potentially, a large size of data stored in the selection form in the FormDataCollection type parameter can be not full on the client due managed form optimization. As a result, form data from the server is additionally read to pass the parameter.
Have a look at how a selection form is used in the following example. We need to select the Goods catalog items and place them in the Goods tabular section in the GoodsConsumption document. The example is from the demo configuration on 1C:Enterprise platform.
Whenever a selection form is opened from the client code, no more than two server calls are allowed. For this purpose, a local command for opening a selection form in the GoodsConsumption document form module transfers a list of goods from the tabular section to a temporary storage (first call) and opens a selection form (second call) by passing the temporary storage address:
GoodsAddressInStorage = PutGoodsInStorage();
SelectionParameters = New Structure("DocumentGoodsAddress, PricesKind, Warehouse", GoodsAddressInStorage, Object.PricesKind, Object.Warehouse);
SelectionForm = OpenForm("Document.GoodsConsumption.Form.SelectionForm", SelectionParameters, IsObject);
// The function transfers a list of goods to a temporary storage and returns an address
Return PutInTempStorage(Object.Goods.Unload(,"Goods,Price,Count"), UUID);
The selection form receives a list of goods selected from the temporary storage in the OnCreateAtServer handler:
Procedure OnCreateAtServer(Cancel, StandardProcessing)
DocumentGoodsAddress = Parameters.DocumentGoodsAddress;
Whenever a selection form is closed, no more than two server calls are allowed. When being closed, the selection form places a list of selected goods in the temporary storage (first call):
The document form restores a list of goods from the temporary storage (second server call):
Procedure ProcessSelection() Export