Skip to content

Instantly share code, notes, and snippets.

@DanKinsella
Last active June 14, 2020 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanKinsella/3843291017e7a6d8a8ed1b60ee311383 to your computer and use it in GitHub Desktop.
Save DanKinsella/3843291017e7a6d8a8ed1b60ee311383 to your computer and use it in GitHub Desktop.
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