Custom actions
Custom actions allow you to add buttons and menu items to Quality Control App screens via a per-tenant extension (PTE). When a user selects a custom action, the app passes the action's code back to Business Central, where your subscriber runs the associated logic.
Supported screens
Custom actions can be added to the following screens:
- QC check
- Posted QC check
- QC action
- Posted QC action
Register custom actions
To make a custom action available on a screen, subscribe to the relevant registration event. Each screen has its own event. In your subscriber, append one or more CustomAction objects to the ActionsArray parameter.
QCABCCustomActions92FDW.Codeunit.al
[IntegrationEvent(false, false)]
local procedure OnGetQualityCheckCustomActions(QCCheckHeaderNo: Code[20]; var ActionsArray: JsonArray)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnGetPostedQualityCheckCustomActions(PostedQCCheckHeaderNo: Code[20]; var ActionsArray: JsonArray)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnGetQualityActionCustomActions(QCActionHeaderNo: Code[20]; var ActionsArray: JsonArray)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnGetPostedQualityActionCustomActions(PostedQCActionHeaderNo: Code[20]; var ActionsArray: JsonArray)
begin
end;
The first parameter in each event is the number of the record currently open in the app. Use this to conditionally show actions based on the record.
CustomAction object
Each entry in ActionsArray must be a JsonObject with the following fields:
| Field | Type | Description |
|---|---|---|
caption | Text | The label displayed in the app for this action. |
actionCode | Text | A unique identifier for this action. This value is passed back to Business Central when the action is selected. |
isPromoted | Boolean | When true, the action is rendered as a standalone button. When false, it appears in the overflow (kebab) menu. Only the first promoted action receives a dedicated button. |
refetchActiveQueries | Boolean | When true, the app refreshes its displayed data after the action completes. Set to true if the action modifies data shown on the screen. |
Run custom actions
When a user selects a custom action, the app fires the following event, passing the actionCode you defined during registration:
QCABCCustomActions92FDW.Codeunit.al
[IntegrationEvent(false, false)]
local procedure OnCallCustomAction(CustomAction: Text; QCDocumentNo: Code[20])
begin
end;
Use a case statement on CustomAction to identify which action was selected and run the appropriate logic.
Example
The following example registers two custom actions on the QC check screen and handles their execution:
[EventSubscriber(ObjectType::Codeunit, Codeunit::QCABCCustomActions92FDW, OnGetQualityCheckCustomActions, '', false, false)]
local procedure RegisterQCCheckActions(QCCheckHeaderNo: Code[20]; var ActionsArray: JsonArray)
var
ActionObject: JsonObject;
begin
Clear(ActionObject);
ActionObject.Add('caption', 'Send Notification');
ActionObject.Add('actionCode', 'SendNotification');
ActionObject.Add('isPromoted', true);
ActionObject.Add('refetchActiveQueries', false);
ActionsArray.Add(ActionObject);
Clear(ActionObject);
ActionObject.Add('caption', 'Log External Event');
ActionObject.Add('actionCode', 'LogEvent');
ActionObject.Add('isPromoted', false);
ActionObject.Add('refetchActiveQueries', false);
ActionsArray.Add(ActionObject);
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::QCABCCustomActions92FDW, OnCallCustomAction, '', false, false)]
local procedure HandleQCCheckAction(CustomAction: Text; QCDocumentNo: Code[20])
begin
case CustomAction of
'SendNotification':
// your notification logic here
;
'LogEvent':
// your logging logic here
;
end;
end;
Appearance
All actions for a screen are accessible through the overflow menu (three dots) in the top-right corner of the screen. The first action with isPromoted set to true is additionally rendered as a dedicated button, reducing the number of clicks required to execute it.