Adding widget to CRM entity form

Lesson 19 out of 29

Applications frequently enhance the functionality of Bitrix24's CRM, a highly utilized tool. In prior lessons, we have demonstrated the process of embedding widgets from an application.

Adding widget to CRM entity form

4 min

To commence, one must click the "New Application" button, select the preferred region for the future solution's publication, and click the "Create" button on the application card while specifying the "Use REST API" type.

It is essential to activate the "Add Widgets" option, which will add "Application Embedding" to the list of scopes.

After downloading the example attached to the tutorial, upload it to a server, insert the uploaded application's paths into the version form, and copy the client_id and client_secret values into the appropriate constants in the settings.php file.

Accessibility from an external network

Note that the URL of the uploaded example must be accessible from the external network and must not be hosted on localhost or use self-signed SSL certificates. Ensure that the URL is available through third-party services and that the web server supports access from frames, as widgets will not function otherwise.

In the example code's install.php, the authorization tokens are stored for later use with the installApp method.

Tokens are immediately used with the placement.bind method, which requires parameters:

  • the PLACEMENT code,
  • the HANDLER link to the widget's interface,
  • the TITLE widget name as a tab name

Useful

Given that Bitrix24 supports multiple languages and individual users can select their preferred language, it is possible to specify different names for widgets in various languages. Further information on this can be found in the placement.bind method documentation.

In the Developer area, the application can be installed in the specified Bitrix24 for testing before publication in Bitrix24.Market.

Upon installation, Bitrix24 will automatically open the application with its user interface. If the application's primary functionality is a widget, the main URL can be used for onboarding and showcasing the product's functionality.

Useful

If the main functionality of your app is a widget embedded in Bitrix24, you can use the main URL of your application for an onboarding purpose that tells the user about the product functionality and contains some necessary configuration steps.

Upon opening any deal in the CRM, an additional "My App" tab will be present, using the embed handler in the internal frame.

Within the REQUEST array Bitrix24 will provide information such as the placement code and deal ID, which can be utilized in the application's logic through REST API.

The current demonstration showcases the retrieval and display of deal data utilizing the crm.deal.get method by substituting the deal ID garnered from the PLACEMENT_OPTIONS into the method's parameters.

Additionally, the actual application could effortlessly gather customer information, solicit supplementary data from an outside source, and perform a multitude of other functions, all while centering on the present deal.

Resources

Lesson materials: