Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Use this event to

Excerpt

Populate values in OrderList displayed at the mobile device (derived from any of four associated header tables). Parameters includes a RecRef-instance for the header table.

 

This event is executed after each of these following events have been executed already:

Template

Use this event to

Excerpt

Populate values in Orders displayed at the mobile device (derived from any of four associated header tables). Parameters includes a RecRef-instance for the header table.


 

This event is executed after each of these following events have been executed already:


Template

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Pick", 'OnGetPickOrders_OnAfterSetFromAnyHeader''', true, true)]
    procedure OnGetPickOrders_OnAfterSetFromAnyHeader(_RecRef: RecordRefvar _BaseOrderElement: Record "MOB Ns BaseDataModel Element")
    begin
    end;



Example 1

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Pick", 'OnGetPickOrders_OnAfterSetFromAnyHeader''', true, true)]
    procedure MyOnGetPickOrders_OnAfterSetFromAnyHeader(_RecRef: RecordRefvar _BaseOrderElement: Record "MOB Ns BaseDataModel Element")
    var
        AssignedUserIdFldNo: Integer;
    begin
        AssignedUserIdFldNo := FieldName2FieldNo(_RecRef, 'Assigned User ID');



        if (AssignedUserIdFldNo <> 0then
            _BaseOrderElement.SetValue('MyAssignedUserID''Assigned to: ' + GetValueByFieldNo(_RecRef, AssignedUserIdFldNo));

        _BaseOrderElement.Set_DisplayLine2('Set from OnGetPickOrders_OnAfterSetFromAnyHeader')// override value previously set at table event
    end;


Example 2

// [Example]: Sort by custom tag
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS ReceiveMOB WMS Pick", 'OnGetReceiveOrdersOnGetPickOrders_OnAfterSetFromAnyHeader''', true true, true true)]
    procedure OnGetReceiveOrders MySortByCustomTag_OnGetPickOrders_OnAfterSetFromAnyHeader(_RecRef: RecordRefvar _BaseOrderElement: _BaseOrderElement: Record "MOB Ns BaseDataModel Element")
beginend;

Example

[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnAfterSetFromAnyHeader''', true, true)]
procedure OnGetReceiveOrders_OnAfterSetFromAnyHeader(_RecRef: RecordRefvar _BaseOrderElement: Record "MOB Ns BaseDataModel Element")
var
     AssignedUserIdFldNo: Integer;
begin
     AssignedUserIdFldNo := FieldName2FieldNo(_RecRef, 'Assigned User ID');
     if (AssignedUserIdFldNo <> 0then
          _BaseOrderElement.SetValue('MyAssignedUserID''Assigned to: ' + GetValueByFieldNo(_RecRef, AssignedUserIdFldNo));

     _BaseOrderElement.Set_DisplayLine2('Set from OnGetReceiveOrders_OnAfterSetFromAnyHeader')// override value previously set at table event
end;

Example: Sort by custom tag

[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnAfterSetFromAnyHeader''', true, true)]
procedure OnGetReceiveOrders_OnAfterSetFromAnyHeader(_RecRef: RecordRefvar _BaseOrderElement: Record "MOB Ns BaseDataModel Element")
var
     AssignedUserIdFldNo: Integer;
begin
     AssignedUserIdFldNo := FieldName2FieldNo(_RecRef, 'Assigned User ID');
     if (AssignedUserIdFldNo <> 0then
          _BaseOrderElement.SetValue('MyAssignedUserID''Assigned to: ' + GetValueByFieldNo(_RecRef, AssignedUserIdFldNo));

     _HeaderElement.Set_Sorting1(GetValue('AssignedUserID'));
Record "MOB Ns BaseDataModel Element")
    var
        AssignedUserIdFldNo: Integer;
    begin
        with _BaseOrderElement do begin
            AssignedUserIdFldNo := FieldName2FieldNo(_RecRef, 'Assigned User ID');



            if (AssignedUserIdFldNo <> 0then
                SetValue('AssignedUserID''Assigned to: ' + GetValueByFieldNo(_RecRef, AssignedUserIdFldNo));

            Set_Sorting1(CopyStr(GetValue('AssignedUserID')1, MaxStrLen("Sorting1 (internal)")));
            Set_Sorting2(CopyStr(Get_ItemNumber()1, MaxStrLen("Sorting2 (internal)")));
        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());
    end;



Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
titleMore examples
excerptTypesimple
cqllabel = "bc" and label = "orders" and label = "example" and label = "onaftersetfrom"

...