Versions Compared

Key

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

Use this event to

Excerpt

Populate values in OrderList 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 ReceiveMOB WMS Receive", 'OnGetReceiveOrders_OnAfterSetFromAnyHeader''', true true, true true)]
    local procedure OnGetReceiveOrders_OnAfterSetFromAnyHeader(_RecRef: RecordRefvar _BaseOrderElement: Record "MOB Ns BaseDataModel ElementMOB Ns BaseDataModel Element")
    begin
    end;


Example

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

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

Example: Sort by custom tag

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

        _HeaderElementBaseOrderElement.Set_Sorting1(_BaseOrderElement.GetValue('AssignedUserID'));
    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;
        ValueText: Text;
    begin
        NewFieldRef := _RecRef.Field(_FieldNo);
        ValueText := format(NewFieldRef.Value());
        exit(ValueText);
    end;



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

...