Customize dialog windows
This functionality is available for Creatio 8.1.4 and later.
@creatio-devkit/common includes the DialogService service that opens dialog windows.
Detailed example: Display the dialog window on a page.
To display a dialog window on a page:
-
Add a button to open a dialog window if needed. Instructions: Set up Button components (user documentation).
-
Add the dependencies. Instructions: Display the value of a system variable (similarly to step 2). Instead of the
SysValuesServiceservice, use theDialogServiceservice that opens dialog windows. -
Add an attribute. Instructions: Set up the field display condition (step 2).
-
Set up how to handle the action executed on button click. Instructions: Optimize the execution of a custom business logic (step 4).
-
Implement the base request handler.
-
Go to the
handlersschema section. -
Add a custom implementation of the
crt.ShowDialogbase request handler.- Create an instance of the dialog service from
@creatio-devkit/common. - Retrieve data based on your business goals and specify data in the corresponding attribute.
- Display the attribute value in the dialog window.
- Create an instance of the dialog service from
View an example of a
crt.ShowDialogrequest handler that opens the dialog window and includes theSomeAttributeattribute value, below.handlers schema sectionhandlers: /**SCHEMA_HANDLERS*/[{request: "crt.ShowDialog",/* Custom implementation of a system request handler. */handler: async (request, next) => {/* Create an instance of the dialog service from "@creatio-devkit/common." */const dialogService = new sdk.DialogService();/* Retrieve data based on your business logic. */...;/* Specify data in the "SomeAttribute" attribute. */request.$context.SomeAttribute = someValue;/* Display the "SomeAttribute" attribute value in the dialog window. */const result = await dialogService.open({message: request.$context.SomeAttribute,actions: [{key: 'Yes',config: {color: 'primary',caption: 'Caption of custom button',}},{key: 'No',config: {color: 'default',caption: 'Caption of custom button',}},]});/* Call the next handler if it exists and return its result. */return next?.handle(request);},},] /**SCHEMA_HANDLERS*/, -
See also
Set up Button components (user documentation)