ebs.openBusinessUnitModal
(FintechOS Studio 24.4.3 and later)
Opens a business unit selection modal that allows users assigned to multiple units to change their business unit context. The modal displays the currently active business unit and a drop-down list of the business units available to the user.
Syntax
ebs.openBusinessUnitModal(handler?: () => void): IBusinessUnitModal;
| Parameter | Data Type | Description |
|---|---|---|
handler (optional) |
Function |
Optional callback function executed once the user confirms the business unit selection:
|
Response
Returns an object matching the IBusinessUnitModal interface, which allows you to interact with the modal.
Interfaces
IBusinessUnitModal
Represents a business unit selection modal. Provides references to the modal UI elements and a method used to remove the modal from the DOM.
interface IBusinessUnitModal {
overlay: HTMLDivElement;
dialog: HTMLDivElement;
select: DevExpress.ui.dxSelectBox;
button: HTMLButtonElement;
destroy: () => void;
}
| Property | Type | Description |
|---|---|---|
| overlay | HTMLDivElement | Reference to the background overlay element displayed behind the modal. |
| dialog | HTMLDivElement | Reference to the modal dialog container. |
| select | DevExpress.ui.dxSelectBox | Reference to the DevExpress drop-down component used to select the business unit. |
| button | HTMLButtonElement | Reference to the modal confirmation button. |
| destroy | () => void | Method used to remove the modal from the Document Object Model. |
Examples
This example displays a business unit selection modal. After the user confirms the selection, the page reloads using the newly selected business unit context.
openBusinessUnitModal();
This example:
- Opens a business unit selection modal and stores it in the modalObj constant.
- The function receives a callback handler which, once the user confirms the selection:
- Defines a navigation URL at the https://ftos:10000/portal/#/entity/Account/insert/form/FDF_Report_DsPdfViewer/ address.
- Redirect the user to the navigation URL using the ebs.goToUrl function.
- Removes the modal from the DOM.
const modalObj = ebs.openBusinessUnitModal(function(){
const url = "https://ftos:10000/portal/#/entity/Account/insert/form/FDF_Report_DsPdfViewer/";
ebs.goToUrl(url);
modalObj.destroy();
})
This example demonstrates how to customize the modal appearance and behavior. The script:
- Opens the business unit selection modal and stores it in the modal object.
- Customizes the modal dialog’s width and background color.
- Changes the confirmation button text to “Confirm business unit”.
- Enables the search functionality in the business unit drop-down list.
- Adds a click event listener to the confirmation button that logs a message when the selection is confirmed.
const modal = ebs.openBusinessUnitModal();
modal.dialog.style.width = "600px";
modal.dialog.style.background = "#f5f5f5";
modal.button.textContent = "Confirm business unit";
modal.select.option({
searchEnabled: true
});
modal.button.addEventListener("click", function () {
console.log("Selection confirmed");
});