此内容没有您所选择的语言版本。
2.6. Extending Business Central
Starting with version 6.1 of JBoss BPM Suite, Business Central can be configured to add new screens, menus, editors, splashscreens and perspectives by the Administrator. These elements can extend functionality of Business Central and can be accessed through the menu and are classified under
Plugin Management
.
You can now define your own Javascript and HTML based plugins to extend Business Central and add them without having to worry about copying files in the underlying filesystem. Let's add a new screen in the system to show you the basics of this functionality.
2.6.1. Plugin Management 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
You access the . This brings up the Plugin Explorer screen that lists all the existing plugins under their respective categories: Perspective Plugin, Screen Plugin, Editor Plugin, Splashscreen Plugin and Dynamic Menu. Open up any of these and you will see the existing plugins in each category, including the uneditable system generated ones.
Plugin Management
screen by clicking on
Let's create a new plugin that echoes "Hello World" when users visit the screen for that plugin. In general, the steps to creating a new plugin are:
- Create a new screen
- Create a new perspective (and add the new screen to it)
- Create a new menu (and add the new perspective to it)
- Apps (optional)
Adding a new Screen
Click on
button and select . You will be prompted to enter the name of this new screen. Enter "HelloWorldJS" and press the button. The Screen plugin editor will open up, divided into 4 sections: Template, CSS, JavaScript and Media.

Note
All manually created elements go into their respective categories in case you want to edit them later. In this case, to open up the Screen plugin editor again if you close it, open up the Screen Plugin category and scroll past the system generated screens to your manually created plugin and click on it to open up the Screen plugin editor again.
Template is where your HTML goes, CSS is for styling, JavaScript is for your functions and Media is for uploading and managing images.
Since we are making a simple Hello World plugin, enter the following code in the Template section:
<div>My Hello World Screen</div>
. This can be any HTML code, and you can use the supplied Angular
and Knockout
frameworks. For the purposes of this example, we are not using any of those frameworks, but you can choose to by selecting them from the drop down in the Template section.
Enter your JavaScript code in the JavaScript section. Some common methods and properties are defined for you, including
main
, on_close
and on_open
. For this demo, select the on_open
and enter the following: function () { alert('Hello World'); }
Click the
button to finish creating the screen. After you save the screen, refresh business central so that the Screen Plugin is listed in the Screen Component of Perspective plugin.
Adding a new Perspective
Once a screen has been created, you need to create a perspective on which this screen will reside. Perspectives can also be created similar to the way a screen is created by clicking on the New button and then selecting,
. You can now provide a name for this perspective, say HelloWorldPerspective
. This will open up the Perspective plugin editor, similar to the Screen plugin editor. .
The Perspective Editor is like a drag and drop grid builder for screens and HTML components. Remove any existing grids and then drag a
6 6
grid on the right hand side to the left hand side.
Next, open up the Components category and drag a Screen Component on the right hand side to the left hand side (in any grid). This will open up the Edit Component dialog box that allows you to select the screen created in the previous step (
HelloWorldJS
). Click the button and then click the button to save this perspective. To tag your perspective, enter Home
in the tag name field and click the button. Click the button and save the changes.
You can open this perspective again from the Perspective plugins listed on the left hand side.
Adding a new menu
The final step in creating our plugin is to add a dynamic menu from where the new screen/perspective can be called up. To do so, go to and then click on the New button to select . Give this dynamic menu a name (HelloWorldMenu) and then click the button. The dynamic menu editor opens up.
Enter the perspective name (HelloWorldPerspective) as the Activity Id and the name for the drop down menu (HelloWorldMenuDropDown). Click and then click the button.
This new menu will be added to your workbench the next time you refresh Business Central. Refresh it now to see
added to your top level menu. Click on it to reveal which when clicked will open up your perspective/screen with the message Hello World
.
You have created your first Plugin!
Working with Apps (Optional)
If you create multiple plugins, you can use the Apps directory feature to organize your own components and plugins, instead of having to rely on just the top menu entries.
When you save a new perspective, you can add labels (tags) for them and these labels (tags) are used to associate a perspective with an App directory. You can open up the App directories by clicking on .
The Apps directory provides an alternate way to open up your perspective. When you created your
HelloWorldPerspective
, you entered the tag Home
. The Apps directory by default contains a single directory called Home
with which you associated your perspective. This is where you will find it when you open the Apps directory. You can click on it to run the perspective now.
You can create multiple directories and associate perspectives with those directories depending on functional and vertical business requirements. For example, you could create an HR directory and then associate all HR related perspectives with that directory to better manage Apps.
You can create a new directory by clicking on the New button

2.6.2. The JavaScript (JS) API for Extensions 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The extensibility of Business Central is achieved by an underlying JavaScript (JS) API which is automatically loaded if it is placed in the
plugins
folder of the Business Central webapp (typically: {INSTALL_DIR}/business-central.war/plugins/) or it can be loaded via regular JavaScript calls.
This API is divided into multiple sets depending on the functionality it performs.
- Register Perspective API: allows for the dynamic creation of perspectives. The example below creates a panel using the
registerPerspective
method:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Editor API: allows you to dynamically create editors and associate them with a file type. The example below creates a sample editor and associates it with
filename
file type.In addition toCopy to Clipboard Copied! Toggle word wrap Toggle overflow on_startup
andon_open
methods seen in the previous example, the API exposes the following callback events for managing the editor's lifecycle:You can display this editor via an html template:- on_concurrent_update;
- on_concurrent_delete;
- on_concurrent_rename;
- on_concurrent_copy;
- on_rename;
- on_delete;
- on_copy;
- on_update;
- on_open;
- on_close;
- on_focus;
- on_lost_focus;
- on_may_close;
- on_startup;
- on_shutdown;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - PlaceManager API: the methods of this API allow you to request that the Business Central display a particular component associated with a target:
$goToPlace("componentIdentifier");
- Register plugin API: the methods of this API allow you to create dynamic plugins (that will be transformed in Business Central screens) via the JS API.The plugin references the
Copy to Clipboard Copied! Toggle word wrap Toggle overflow angular.sample.html
template:A plugin can be hooked to Business Central events via a series of JavaScript callbacks:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - on_concurrent_update;
- on_concurrent_delete;
- on_concurrent_rename;
- on_concurrent_copy;
- on_rename;
- on_delete;
- on_copy;
- on_update;
- on_open;
- on_close;
- on_focus;
- on_lost_focus;
- on_may_close;
- on_startup;
- on_shutdown;
- Register splash screens API: use the methods in this API to create splash screens.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Virtual File System (VFS) API: with this API, you can read and write a file saved in the file system using an asynchronous call.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow