Install
$ agentstack add skill-emgreppi-business-central-ai-skill-handling-bc-files ✓ 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 File Handling
Validation Gates
- After Step 1:
UploadIntoStreamopens file dialog, InStream contains data - After Step 2: Attachment saved to Document Attachment or custom table
- Final: XMLport imports/exports successfully, Azure Blob upload returns
IsSuccessful()
Note: ALWAYS CalcFields(BlobField) before CreateInStream. Web Client allows only ONE DownloadFromStream per request.
Procedure
Step 1: Upload/Download Files
// Upload
if UploadIntoStream('Select file', '', 'All Files (*.*)|*.*', FileName, InStr) then
// Process InStr
// Download - MUST CalcFields first for Blob
CalcFields("File Content");
if "File Content".HasValue() then begin
"File Content".CreateInStream(InStr);
DownloadFromStream(InStr, '', '', '', FileName);
end;
Step 2: Document Attachments
Standard (Table 1173):
// Replace and field names with your record
DocumentAttachment.Init();
DocumentAttachment.Validate("Table ID", Database::);
DocumentAttachment.Validate("No.", ."");
DocumentAttachment.Validate("Document Type", .""); // If applicable
DocumentAttachment.InsertFromStream(InStr, FileName);
Custom Blob field:
Rec."File Content".CreateOutStream(OutStr);
CopyStream(OutStr, InStr);
Rec.Modify();
Step 3: XMLport Import/Export
xmlport " Import Data"
{
Direction = Import;
Format = VariableText;
FieldDelimiter = '"';
FieldSeparator = ';';
TextEncoding = UTF8;
schema
{
textelement(Root)
{
tableelement(TempImport; " Import Buffer")
{
UseTemporary = true;
AutoSave = false;
fieldelement(ItemNo; TempImport."Item No.") { }
fieldelement(Description; TempImport.Description) { }
trigger OnAfterInsertRecord()
begin
ProcessLine(TempImport);
end;
}
}
}
}
Key properties: Direction (Import/Export/Both), Format (Xml/VariableText/FixedText), TextEncoding (UTF8/UTF16)
Step 4: Azure Blob Storage (Optional)
var
ABSBlobClient: Codeunit "ABS Blob Client";
StorageServiceAuthorization: Codeunit "Storage Service Authorization";
Authorization: Interface "Storage Service Authorization";
begin
Authorization := StorageServiceAuthorization.CreateSAS(GetSASToken());
ABSBlobClient.Initialize(AccountName, ContainerName, Authorization);
// Upload
TempBlob.CreateInStream(InStr);
ABSOperationResponse := ABSBlobClient.PutBlobBlockBlobStream(BlobName, InStr);
// Download
ABSOperationResponse := ABSBlobClient.GetBlobAsStream(BlobName, InStr);
end;
Requires: Azure Storage Account + SAS Token in Isolated Storage.
Persistent Blob (Cross-Session)
// Store (returns GUID key)
BlobKey := PersistentBlob.Create();
PersistentBlob.CreateOutStream(OutStr);
OutStr.WriteText(Data);
// Retrieve
PersistentBlob.CreateInStream(BlobKey, InStr);
InStr.ReadText(Data);
PersistentBlob.Delete(BlobKey); // Clean up
⚠️ NOT for permanent storage - causes locking issues.
JSON/XML Quick Reference
// JSON
JsonObj.Add('key', 'value');
JsonObj.WriteTo(JsonText);
JsonObj.ReadFrom(JsonText);
if JsonObj.Get('key', JsonTok) then MyText := JsonTok.AsValue().AsText();
// XML
XmlDoc := XmlDocument.Create();
XmlDoc.Add(XmlElement.Create('Root'));
XmlDocument.ReadFrom(XmlText, XmlDoc);
XmlDoc.SelectSingleNode('//Child', XmlNode);
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.