Use this event to
Excerpt |
---|
Change the data on the selected label just before it is sent to the Cloud Print Service |
...
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
local procedure OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
begin
end;
Example 1: Modify labels on Item Label
// [Example 01]
// Read the Item No. from Dataset and change it
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
local procedure Ex02OnPrintLabel Ex01OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
begin
// Making sure we only handle our own Label-Template
if _TemplateName <> 'Item Label 4x6My custom Label-Template' then
exit;
// Modify labels Read the Item No. from Dataset and change it
// Item No. could have been collected or transferred from "context"/source table, where the print action was selected by the user
if _Dataset.SetValueGetValue('UnitOfMeasure_Label',ItemNumber') = 'UnitsItemA'); then
_Dataset.SetValue('LotNumber_LabelItemNumber', 'Batch No. ItemB');
end;
Example 2: Set extra info fields and their labels
// [Example 02]
// Read Source record
// Set ExtraInfo fields, their labels in dataset
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateDataset', '', true, true)]
local procedure Ex03OnPrintLabel_OnAfterPopulateDataset(_TemplateName: Text[50]; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
var
Item: Record Item;
Vendor: Record Vendor;
begin
// Making sure we only handle our own Label-Template
if _TemplateName <> 'Item Label 4x6Item Label 4x6' then
exit;
// Set extra info fields and their labels If source is "Item" = Get record from RecordRef
if _SourceRecRef.Number = database::Item then
_SourceRecRef.SetTable(Item);
// Set extrainfo fields and their labels in the Dataset
_Dataset.SetValue('ExtraInfo01_Label', 'Desc.');
_Dataset.SetValue('ExtraInfo01_Value', Item.Description);
_Dataset.SetValue('ExtraInfo01ExtraInfo02_Label', 'ExtraInfo01_LabelGTIN');
_Dataset.SetValue('ExtraInfo02', 'ExtraInfo02_Value' Item.GTIN);
_Dataset.SetValue('ExtraInfo02ExtraInfo03_Label', 'ExtraInfo02_LabelPurchasing Unit');
_Dataset.SetValue('ExtraInfo03', 'ExtraInfo03_Value' Item."Purch. Unit of Measure");
_Dataset.SetValue('ExtraInfo03ExtraInfo04_Label', 'ExtraInfo03_Label');'Vendor');
if Vendor.Get(item."Vendor No.") then
_Dataset.SetValue('ExtraInfo04', Vendor.Name);
// Additional custom values can also be used on the label
_Dataset.SetValue('ExtraInfo04CustomValueA', 'ExtraInfo04_ValueA');
_Dataset.SetValue('ExtraInfo04_LabelCustomValueB', 'ExtraInfo04_LabelB');
end;
Filter by label (Content by label) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...