Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating an LS Central POS command
codeunit 50100 "LS POS Command Demo"
{
TableNo = "POS Menu Line";
trigger OnRun()
begin
if Rec."Registration Mode" then
Register(Rec)
else
case Rec.Command of
GetHelloWorldCommand():
HelloWorld();
end;
end;
local procedure Register(var POSMenuLine: Record "POS Menu Line")
var
POSCommandReg: Codeunit "POS Command Registration";
ModuleDescription: Label 'DanKinsella.blog - Demo';
HelloWorldCommandDesc: Label 'Say hello to the cashier.';
begin
// Register the module:
POSCommandReg.RegisterModule(GetModuleCode(), ModuleDescription, Codeunit::"LS POS Command Demo");
// Register the command, as many lines as there are commands in the Codeunit:
POSCommandReg.RegisterExtCommand(GetHelloWorldCommand(), HelloWorldCommandDesc, Codeunit::"LS POS Command Demo", 0, GetModuleCode(), true);
POSMenuLine."Registration Mode" := false;
end;
procedure GetModuleCode() : Code[20]
var
ModuleCode: Label 'DANKINSELLA.BLOG', Locked = true;
begin
exit(ModuleCode);
end;
procedure GetHelloWorldCommand() : Code[20]
var
HelloWorldCommand: Label 'HELLOWORLD', locked = true;
begin
exit(HelloWorldCommand);
end;
procedure HelloWorld()
var
HelloWorldMsg: Label 'Hello World!';
begin
Message(HelloWorldMsg);
end;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.