Add button “Find in list” to all catalogs and documents

Publications: Add button Find in list to all catalogs and documents

I did not find the button “Find in list” in the typical solutions on the manageable forms (Accounting 3.0, Trade Management 11) and was very surprised at first, but then decided to add it. It is possible to add a button just in few minutes to all necessary documents and catalogs, and during the update you will not need to do anything else - just a single common command is added.

So, point by point:
1. Create common command “FindInList”
2. In the command properties specify:

  • Group - Form navigation panel.Important
  • Command parameter type - set the flag “Composite data type” and check those catalogs and documents in which we want to see our button.
  • Display - Picture
  • Picture - select the appropriate picture.

The remaining properties are used unchanged.

3. In the command module insert the following code:

&AtClient
Procedure CommandProcessing(CommandParameter, CommandExecuteParameters)
    
    MetaName = ReturnName(CommandParameter);
    
    FindOpen = False;
    
    Window = GetWindows();
    For Each Window In Window Do
    
        Form = Window.GetContent();
        
        If Form = Undefined Then
            Continue;
        EndIf;    
        
        If Form.FormName = MetaName + ".Form.ListForm" Then
            Form.Items.List.CurrentRow = CommandParameter;
            Form.Activate();
            FindOpen = True;
        EndIf;
        
    EndDo;
    
    If Not FindOpen Then
        OpenForm(MetaName + ".ListForm", New Structure("CurrentRow", CommandParameter));  
    EndIf;    
	
EndProcedure

&AtServer
Function ReturnName(CommandParameter)

    Return CommandParameter.Metadata().FullName();
	
EndFunction

That is all, the button is ready - save, run, use.

Publications: Add button Find in list to all catalogs and documents

Everything is very simple and fast, but there is one point. Now you button appeared in the form of item (document) and in the list form that obviously does not make sense. But to remove it from the list forms, it is required to go to each form and uncheck the corresponding flag in the command form interface - section Command panel - Important. In principle, you can not to do this - clicking the button on the list form will not result in an error, but you will not have to do this operation during the updates.
Have a good code!

Click to rate this post!
[Total: 0 Average: 0]

Leave a Reply

Your email address will not be published. Required fields are marked *