Open a page from a custom handler
Creatio 8 Atlas uses the HandlerChainService
service to open pages. Creatio 7.X and Creatio 8 Atlas use the same method to open record pages. You can pass the needed default column values when Creatio adds a record.
Creatio 8 Atlas provides the following actions to open pages from a custom handler:
- Open a record page from a custom handler.
- Open a Freedom UI page from a custom handler.
Open a record page from a custom handler
-
Add a page button that opens the record page on click at step 1 of the Freedom UI page customization procedure if needed.
-
Set up how to open the record page from a custom handler at step 2 of the Freedom UI page customization procedure.
-
Enable the
HandlerChainService
service that opens pages. Enable the service similarly to the display procedure for the value of system variables. -
Bind the
clicked
property to the corresponding request in theviewConfigDiff
schema section. Describe the business logic that opens the page in thehandlers
schema section. Theclicked
property is responsible for the action performed on button click.View an example that binds the
clicked
property to theusr.SomeRequest
custom request below.viewConfigDiff schema sectionviewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
{
"values": {
"clicked": {
/* Bind a custom usr.SomeRequest request to the clicked button event. */
"request": "usr.SomeRequest"
}
},
}
]/**SCHEMA_VIEW_CONFIG_DIFF*/, -
Add the implementation of a custom request to the
handlers
schema section.To open a page:
- Get an instance of the
HandlerChainService
singleton service that opens pages. - Send a
crt.UpdateRecordRequest
system request that opens the page by the specified ID.
View an example of the
usr.SomeRequest
request handler that sends thecrt.UpdateRecordRequest
system request below. Thecrt.UpdateRecordRequest
request opens the page of theSomeSchemaName
record with theSomeRecordId
ID.handlers schema sectionhandlers: /**SCHEMA_HANDLERS*/[
{
request: "usr.SomeRequest",
/* Implementation of the custom request handler. */
handler: async (request, next) => {
/* Get an instance of the singleton service that opens pages. */
const handlerChain = sdk.HandlerChainService.instance;
/* Send a crt.UpdateRecordRequest system request that opens the page with the specified ID. */
await handlerChain.process({
type: 'crt.UpdateRecordRequest',
entityName: 'SomeSchemaName',
recordId: 'SomeRecordId',
$context: request.$context
});
/* Call the next handler if it exists and return its result. */
return next?.handle(request);
}
}
] /**SCHEMA_HANDLERS*/,To open the page and populate the fields with the specified values:
- Get an instance of the
HandlerChainService
singleton service that opens pages. - Send the
crt.CreateRecordRequest
system request that creates a page with fields populated with the specified values.
View an example of the
usr.SomeRequest
request handler that sends thecrt.CreateRecordRequest
system request below. Thecrt.CreateRecordRequest
request opens theSomeSchemaName
record page and populates the SomeField field with the "SomeRecordId" value.handlers schema sectionhandlers: /**SCHEMA_HANDLERS*/[
{
request: "usr.SomeRequest",
/* Implementation of the custom request handler. */
handler: async (request, next) => {
/* Get an instance of the singleton service that opens pages. */
const handlerChain = sdk.HandlerChainService.instance;
/* Send a crt.CreateRecordRequest system request that opens the specified page. Populate the [SomeField] field with the SomeFieldValue value. */
await handlerChain.process({
type: 'crt.CreateRecordRequest',
entityName: 'SomeSchemaName',
defaultValues: [{
attributeName: 'SomeField',
value: 'SomeFieldValue'
}],
$context: request.$context
});
/* Call the next handler if it exists and return its result. */
return next?.handle(request);
}
}
] /**SCHEMA_HANDLERS*/, - Get an instance of the
-
View a detailed example that opens a record page in a separate article: Open a record page from a custom handler.
Open a Freedom UI page from a custom handler
-
Take steps 1-2 from the procedure to open the record page from a custom handler.
-
Set up how to open a Freedom UI page from a custom handler at step 2 of the procedure for opening the record page from a custom handler. To do this, add the implementation of a custom request to the
handlers
schema section.- Get an instance of the
HandlerChainService
singleton service that opens pages. - Send a
crt.OpenPageRequest
system request that opens the Freedom UI page with the specified name.
View an example
usr.SomeRequest
request handler that sends thecrt.OpenPageRequest
system request below. Thecrt.OpenPageRequest
request opens theSomePageName
page.handlers schema sectionhandlers: /**SCHEMA_HANDLERS*/[
{
request: "usr.SomeRequest",
/* Implementation of the custom request handler. */
handler: async (request, next) => {
/* Get an instance of the singleton service that opens pages. */
const handlerChain = sdk.HandlerChainService.instance;
/* Send a crt.OpenPageRequest system request that opens the page. */
await handlerChain.process({
type: 'crt.OpenPageRequest',
schemaName: 'SomePageName',
$context: request.$context
});
/* Call the next handler if it exists and return its result. */
return next?.handle(request);
}
}
] /**SCHEMA_HANDLERS*/, - Get an instance of the
View a detailed example that opens a Freedom UI page in a separate article: Open a Freedom UI page from a custom handler.