On buttons and panels within the LS Central POS, you can use placeholders to insert dynamically generated text. A placeholder is fx. <#ReceiptNo> which is replaced by the current Receipt No. on runtime.
As a developer you can implement your own placeholders.
The pattern is pretty simple as LS has provided an Event Subscriber which let you include you own data.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"POS Transaction Events", 'OnAfterGetContext', '', false, false)] local procedure OnAfterGetContext(var CurrInput: Text; var POSTransaction: Record "POS Transaction"; var POSTransLine: Record "POS Trans. Line") var POSSession: Codeunit "POS Session"; begin POSSession.SetValue('<#MyUserName>', GetUserName()); end;
I’ve created a function which return the Full Name of the current user.
local procedure GetUserName(): Text var User: Record "User"; UnknownNameLbl: Label '<N/A>'; begin User.Get(UserSecurityId()); if User."Full Name" = '' then exit(UnknownNameLbl); exit(User."Full Name"); end;
To implement the Placeholder, I changed the description of the menu item within the POS.