Description
Excerpt |
---|
You want to modify a label template by adding data to it |
...
Let's begin by printing the label as it is so we can track the changes, as we make them.
You must do this from a mobile device.
Step 2 - Add the data
Using the event OnPrintLabel_OnAfterPopulateDataset, we can add Gross Weight and Warehouse Class Code to the label.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
local procedure Ex01OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
var
Item: Record Item;
begin
// Only relevant for Item labels
// Item labels are always called with a RecordRef for "Item". Else exit
if _SourceRecRef.Number = database::Item then
_SourceRecRef.SetTable(Item)
else
exit;
// Set extrainfo fields and their labels, in the dataset
_Dataset.SetValue('ExtraInfo01', Item."Gross Weight");
_Dataset.SetValue('ExtraInfo01_Label', Item.FieldCaption("Gross Weight"));
_Dataset.SetValue('ExtraInfo02', Item."Warehouse Class Code");
_Dataset.SetValue('ExtraInfo02_Label', Item.FieldCaption("Warehouse Class Code"));
end;
Step 3
Verify data is sent to the cloud.
You can do this using "Mobile Print Log" in Business Central or use the designer to preview.
See also
Filter by label (Content by label) | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...