Close the Window with the Application BX24.closeApplication

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

The method BX24.closeApplication sends a command to close the pop-up window with the application.

This method is recommended for use in integrations such as CRM_*_LIST_MENU from the Widgets section. For example, you can add a button that closes the application window.

void BX24.closeApplication([Function callback])
        

Parameters

Name
type

Description

callback
function

A callback function that is executed after the close window command is sent

Code Example

How to Use Examples in Documentation

A unified example for BX24.openApplication and BX24.closeApplication:

<script src="//api.bitrix24.com/api/v1/"></script>
        <?php
        $placementOptions = array();
        if (array_key_exists('PLACEMENT_OPTIONS', $_REQUEST))
        {
            $placementOptions = json_decode($_REQUEST['PLACEMENT_OPTIONS'], true);
        }
        
        if (!isset($placementOptions['opened']))
        {
        ?>
            <span onclick="openApplication()">Open</span>
        <?php
        }
        else
        {
        ?>
            <span onclick="closeApplication()">Close</span>
        <?php
        }
        ?>
        <script>
            function openApplication()
            {
                BX24.openApplication(
                    { opened: true },
                    function()
                    {
                        alert('Application closed!');
                    }
                );
        
                setTimeout(closeApplication, 15000);
            }
        
            function closeApplication()
            {
                BX24.closeApplication();
            }
        </script>
        

Example with Slider

BX24.openApplication(
            { opened: true },
            function () {
                console.log('Application closed');
            },
            {
                width: 450,
                label: {
                    bgColor: 'pink',
                    text: 'my task',
                    color: '#07ff0e'
                },
                title: 'my title'
            }
        );
        
        setTimeout(function () {
            BX24.closeApplication();
        }, 15000);
        

Response Handling

The method does not return data (void).

Continue Learning