Use this event to
Excerpt |
---|
Populate values in Orders displayed at the mobile device (derived from "Phys. Inventory Journals" or "Whse. Phys. Invt. Journals"). Parameters includes a RecRef-instance for the header table. |
...
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Count", 'OnGetCountOrders_OnAfterSetFromAnyBatch', '', true, true)]
local procedure OnGetCountOrders_OnAfterSetFromAnyBatch(_RecRef: RecordRef; var _BaseOrderElement: Record "MOB Ns BaseDataModel Element")
begin
end;
Example
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Count", 'OnGetCountOrders_OnAfterSetFromAnyBatch', '', true, true)]
local procedure MyOnGetCountOrders_OnAfterSetFromAnyBatch(_RecRef: RecordRef; var _BaseOrderElement: Record "MOB Ns BaseDataModel Element")
var
JournalTemplateNameFldNo DataTypeManagement: Codeunit "Data Type Management";
NewFieldRef: IntegerFieldRef;
begin
with _BaseOrderElement do begin
JournalTemplateNameFldNo := FieldName2FieldNoif DataTypeManagement.FindFieldByName(_RecRef, NewFieldRef, 'Journal Template Name'); if (JournalTemplateNameFldNo <> 0) then
SetValue _BaseOrderElement.SetValue('MyJournalTemplateName', 'Journal Template Name: ' + GetValueByFieldNo(_RecRef, JournalTemplateNameFldNo));
Set_DisplayLine2('Set from OnCountOnAfterSetFromAnyBatch'); // override value previously set at table event
end;
end;
local procedure FieldName2FieldNo(var RecRef: RecordRef; FieldNameToConvert: Text): Integer
var
FieldRec: Record Field;
begin
if (StrLen(FieldNameToConvert) > MaxStrLen(FieldRec.FieldName)) then // FieldNameToConvert too long and cannot be a table field name
exit(0);
FieldRec.Reset();
FieldRec.SetCurrentKey("TableNo", FieldName);
FieldRec.SetRange(TableNo, RecRef.Number());
FieldRec.SetRange(FieldName, FieldNameToConvert);
if FieldRec.FindFirst() then
exit(FieldRec."No.");
exit(0);
end;
local procedure GetValueByFieldNo(var RecRef: RecordRef; FieldNo: Integer): Text
var
NewFieldRef: FieldRef;
begin
NewFieldRef := RecRef.Field(FieldNo);
exit(NewFieldRef.Value()); CopyStr(NewFieldRef.Value(), 1, NewFieldRef.Length()));
_BaseOrderElement.Set_DisplayLine2('Set from OnCountOnAfterSetFromAnyBatch'); // override value previously set at table event
end;
Filter by label (Content by label) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...