Install
$ agentstack add skill-emgreppi-business-central-ai-skill-binding-event-subscribers ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Skill: AL Event Binding
Validation Gates
- After Step 1: Manual codeunit compiles, subscribers don't fire without binding
- After Step 2: BindSubscription activates subscriber, events fire correctly
- Final: UnbindSubscription deactivates, no events fire after unbind
Note: Default to StaticAutomatic. Use Manual only for conditional/performance scenarios. Binding is session-specific.
Procedure
Step 1: Create Manual Subscriber Codeunit
codeunit " Subscribers"
{
EventSubscriberInstance = Manual;
[EventSubscriber(ObjectType::Table, Database::, 'OnAfterValidateEvent', '', false, false)]
local procedure OnValidate(var Rec: Record )
begin
// Your validation logic here
if StrLen(Rec.) must be at least 3 characters');
end;
}
Step 2: Bind in Context (Page/Codeunit)
pageextension " Card Ext" extends ""
{
var
EntitySubscribers: Codeunit " Subscribers";
trigger OnOpenPage()
begin
BindSubscription(EntitySubscribers);
end;
trigger OnClosePage()
begin
UnbindSubscription(EntitySubscribers);
end;
}
Common Patterns
Conditional via Setup
procedure ProcessDocument(var SourceRecord: Record )
var
AdvancedValidation: Codeunit " Advanced Validation";
Setup: Record " Setup";
begin
if Setup.Get() and Setup."Enable Advanced Validation" then
BindSubscription(AdvancedValidation);
Codeunit.Run(Codeunit::, SourceRecord);
// Auto-unbinds when procedure ends
end;
Batch Job Optimization
UI subscribers bound only in pages, not in job queue codeunits:
- Page:
OnOpenPage→BindSubscription(UINotifications) - Job Queue: No binding → no UI overhead
Important Notes
Binding behavior:
- Session-specific (Session A binding doesn't affect Session B)
- Auto-dissolves when codeunit instance goes out of scope
- Cannot call Bind/Unbind on
StaticAutomaticcodeunits (runtime error)
Stale metadata: Recompiling bound codeunit shows error "subscriber is stale" - only during development, not production.
⚠️ Do NOT use Manual for critical business logic that must never be missed.
External Documentation
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: emgreppi
- Source: emgreppi/Business-Central-AI-Skill
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.