

Last date modified: March 10 2025
Provides methods for creating and updating action bars. These functions are available under the `convenienceApi.actionBar` namespace.
Boolean
Promise
Promise
A collection of functions that are capable of generating elements used by the action bar with preset defaults
A collection of functions that are capable of generating application-default parts of the action bar
Array.<HTMLElement>
Array.<HTMLElement>
Array.<HTMLElement>
HTMLElement
HTMLElement
| null
Array.<HTMLElement>
Generate appropriate action buttons for a given form view-model
Returns: Array.<HTMLElement>
- list of action button elements
Example
// The following code sample adds default buttons to the right slot of the action bar:
eventHandlers[eventNames.CREATE_ACTION_BAR] = function() {
const actionBar = convenienceApi.actionBar;
const buttons = actionBar.generateDefault.actionButtons();
actionBar.containersPromise.then(function(containers) {
// optional, adds spacing between buttons
containers.rootElement.className = "rwa-button-group";
buttons.forEach(function(button) {
containers.rightSlotElement.appendChild(button);
});
});
};
Array.<HTMLElement>
Generate appropriate action buttons for a given form view-model "New Object" popup.
Returns: Array.<HTMLElement>
- List of action button elements.
Param | Type | Description |
---|---|---|
popupControlApi | Object
|
Popup control API object. |
objectTypeName | String
|
Type name of the object. |
Example
// The following code sample adds a list of action buttons to a pop-up window:
eventHandlers[eventNames.CREATE_ACTION_BAR] = function() {
const actionBar = convenienceApi.actionBar;
const formSettings = convenienceApi.formSettings;
const buttons = actionBar.generateDefault.actionButtonsForAddPopup(
popupControlApi,
formSettings.ObjectTypeName
);
actionBar.containersPromise.then(function(containers) {
containers.rootElement.className = "rwa-button-group";
buttons.forEach(function(button) {
containers.centerSlotElement.appendChild(button);
});
});
};
Array.<HTMLElement>
Generate appropriate action buttons for a given form view-model popup.
Returns: Array.<HTMLElement>
- List of action button elements.
Param | Type | Description |
---|---|---|
popupControlApi | Object
|
Popup control API object. |
Example
// The following code sample adds a default layout drop-down element to the right slot of the action bar:
eventHandlers[eventNames.CREATE_ACTION_BAR] = function() {
const actionBar = convenienceApi.actionBar;
const layoutDropdown = actionBar.generateDefault.layoutDropdown();
actionBar.containersPromise.then(function(containers) {
containers.rightSlotElement.appendChild(layoutDropdown);
});
};
HTMLElement
Generate a default layout dropdown element
Returns: HTMLElement
- layout dropdown element
Example
// The following code sample adds a default layout drop-down element to the right slot of the action bar:
eventHandlers[eventNames.CREATE_ACTION_BAR] = function() {
const actionBar = convenienceApi.actionBar;
const layoutDropdown = actionBar.generateDefault.layoutDropdown();
actionBar.containersPromise.then(function(containers) {
containers.rightSlotElement.appendChild(layoutDropdown);
});
};
HTMLElement
| null
Generate default pager element. Note that when a pager is returned, the page number and page count are already updated.
Returns: HTMLElement
| null
- pager element
Param | Type | Description |
---|---|---|
validateReviewQueue | Boolean | undefined |
(Optional) When exactly true, a pager will only be returned when the pager state is valid, otherwise null is returned. |
Example
// The following code sample adds a pager to the right slot of the custom action bar:
function populateCustomActionBar(containers) {
const actionBar = convenienceApi.actionBar;
const pager = actionBar.generateDefault.objectPager();
containers.rightSlotElement.appendChild(pager);
}
Boolean
Gets the value of the action bar 'isVisible' property
Function to hide or show the action bar
Param | Type | Description |
---|---|---|
value | Boolean
|
if true, display the action bar, hide otherwise |
A collection of functions that provide the ability to save the form and other options
Promise
Promise
Promise
Promise
Promise
Promise
Promise
Promise
undefined
Promise.<Boolean>
Promise
Promise
Form save operation
Returns: Promise
- Promise after save submission
Promise
Form save operation
Returns: Promise
- Promise after submission and its corresponding action.
Promise
Save the form and navigate to the add page for a given object type
Returns: Promise
- Promise after save submission and its corresponding navigation
Promise
Form save operation
Returns: Promise
- Promise after submission and its corresponding action.
Promise
Save the form and switch to the next object
Returns: Promise
- Promise after save submission and its corresponding object switch action
Promise
Save the form and switch to the previous object
Returns: Promise
- Promise after save submission and its corresponding object switch action
Promise
Save the form and navigate to the given artifact id
Returns: Promise
- Promise after save submission and its corresponding navigation
Param | Type | Description |
---|---|---|
requestedArtifactId | Number
|
The artifact id to navigate to after the save completes |
Promise
Attempts to navigate back to the previously visited artifact, if any, otherwise navigates back to item list
Returns: Promise
- Promise that resolves when onCancel finishes navigation or confirmation modal was cancelled
undefined
deletion handler function
Param | Type | Description |
---|---|---|
completedDeleteCallback | function | undefined |
Optional action to be executed after delete is completed. If not provided, action is navigation to item List. |
Promise.<Boolean>
Redirect user to an edit page within the application.
Returns: Promise.<Boolean>
- Promise that resolves to whether the navigation was successful.
Promise
Navigates to the previous page. If the navigation was not successful, the URL is pushed back.
Returns: Promise
- Returns a promise that indicates whether the navigation was successful.
Promise
Initializes default action bar including buttons and layout selector
Returns: Promise
- promise of initialized default action bar
Example
// The following code sample adds a single button to the center slot of the action bar:
eventHandlers[eventNames.CREATE_ACTION_BAR] = function() {
convenienceApi.actionBar.createDefaultActionBar().then(function() {
return convenienceApi.actionBar.containersPromise;
}).then(function(containers) {
const button = convenienceApi.actionBar.generate.button({
innerText: "Say Hello",
onclick: function() {
alert("Hello!");
}
});
containers.centerSlotElement.appendChild(button);
});
}
Promise
Removes children on all available slots on the action bar
Returns: Promise
- promise of a destroyed action bar
Example
// The following code sample destroys the action bar when a specific artifact ID is encountered during the object switching process:
function populateCustomActionBar(containers) {
const actionBar = convenienceApi.actionBar;
const button = actionBar.generate.button({
innerText: "Say Hello",
onclick: function() {
alert("Hello!");
}
});
const pager = actionBar.generateDefault.objectPager();
containers.centerSlotElement.appendChild(button);
containers.rightSlotElement.appendChild(pager);
}
function populateDefaultActionBar() {
convenienceApi.actionBar.createDefaultActionBar();
}
function createActionBar() {
const actionBar = convenienceApi.actionBar;
const formViewModel = this;
// Change to an artifact ID of an instance of the
// given object type that exists in your workspace.
const ARTIFACT_ID_THAT_NEEDS_CUSTOM_ACTION_BAR = 1050081;
return actionBar.destroy().then(function() {
return actionBar.containersPromise;
}).then(function(containers) {
if (formViewModel.artifactId === ARTIFACT_ID_THAT_NEEDS_CUSTOM_ACTION_BAR) {
populateCustomActionBar(containers);
} else {
populateDefaultActionBar();
}
});
}
const eventHandlers = {};
eventHandlers[eventNames.CREATE_ACTION_BAR] = createActionBar;
eventHandlers[eventNames.UPDATE_ACTION_BAR] = createActionBar;
Why was this not helpful?
Check one that applies.
Thank you for your feedback.
Want to tell us more?
Great!
Additional Resources |
|||
DevHelp Community | GitHub | Release Notes | NuGet |