Handling inactive objects

This article describes the standards that apply to inactive objects. All of the listed recommendations are mandatory unless noted otherwise.

This recommendation is optional

1. This recommendation applies to situations when some Infobase object becomes permanently or temporarily inactive (an employee leaves the company or takes a maternity leave, a department no longer exists due to reorganization, and so on); and you cannot simply delete the object because this will impact reference integrity (some other objects reference it). For example, a File object must have a reference to an employee in the Author field even if the author left the company.

2. To prevent inactive objects from popping up in auto-completion and quick choice lists, use one of the approaches listed below (2.1 or 2.2). They are described in the example of Users catalog, which contains the list of information system users.

For marking inactive users, the Inactive(Boolean) attribute is added to the Users catalog. The default attribute value is False.

2.1. If displaying inactive users must be prohibited in all input fields or in a majority of input fields, making it the default choice.

2.1.1. In the Users catalog manager module, implement the ChoiceDataGetProcessing and FormGetProcessing handlers for setting filter parameters. Example:

Procedure ChoiceDataGetProcessing(ChoiceData, Parameters, StandardProcessing)
 If Not Parameters.Filter.Property("Inactive") Then
  Parameters.Filter.Insert("Inactive", False);
 EndIf;
EndProcedure

Procedure FormGetProcessing(FormType, Parameters, SelectedForm,
                            AdditionalInformation, StandardProcessing)
 If FormType = "ChoiceForm" Then 
  ParameterChanged = False;  
  If Not Parameters.Property("Filter") Then
   Parameters.Insert("Filter", New Structure("Inactive", False));
   ParameterChanged = True;
  ElsIf Not Parameters.Filter.Property("Inactive") Then
   Parameters.Filter.Insert("Inactive", False);
   ParameterChanged = True;
  EndIf;
  
  // This code utilizes the changed parameter values
  If ParameterChanged Then  
   StandardProcessing = False;
   SelectedForm = "ChoiceForm"; // Passing the choice form name
  EndIf;
 EndIf;
EndProcedure

2.1.2. For attributes where different application behavior is required (for example, displaying all users or applying another filter), set the ChoiceParameters and ChoiceParameterLinks properties in this context to appropriate values:

  • for displaying inactive users, set the ChoiceParameters property of the attribute to Filter.Inactive(False);
  • for displaying all users without filtering, use both True and False values.

2.2. If the use of an inactive object filter strongly depends on context (usage scenarios), do not make it the default behavior.

  • Do not implement the Users catalog manager module.
  • In the simplest scenario, for all objects that have attributes of CatalogRef.Users type set values of ChoiceParameters and ChoiceParameterLinks properties as described in section 2.1.2.
  • In scenarios where the filter usage criterion cannot be described by choice parameters, implement the ChoiceDataGetProcessing, ChoiceProcessing, and TextEditEnd form handlers and create a separate choice form that implements the filter logic.

3. We recommend that you add the Show inactive users command to the All actions menu of the user list form. It provides you with the option to open user details and make the user activity (for example, you will need this when an employee is back from maternity leave).

4. We recommend that you use the following formatting for displaying inactive objects in lists: InaccessibleCellTextColor (192,192,192).


	

Next page: Length of configuration object codes and numbers

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.