Versions Compared

Key

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

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Description

Excerpt

You may subscribe to posting events in the Business Central base App to process collected values, or when events when events offered by Extension API does do not fit your exact need.


MOB Events

...

The PostReceiveOrder events for Warehouse Receipts handles registrations collected for each individual order line, as well as data from Header steps.

This information applies to all Planned functions.


A common way to post collected data , is to "stage" the collected values, then have standard posting routines pick up the staged values during the actual posting.

...

  • Move "staged" data to the final destination during posting.

  • Process a workflow during posting that requires your data to be rolled back on error.

  • Process a workflow on after posting posting that is not required to be a part of the same database transaction or is not sensitive to not being fully executed in case of error (ie. printing labels).

...

  • Remember, your Events are fired both when posting from the Mobile Device, the Mobile Document Queue, but also when posting from Web Client.
    • So your code must allow execution both when triggered from Mobile WMS, and when triggered from Web Client.

  • The document header field "MOB Posting MessageId" is populated when posting a document from Mobile or Queue but not when posting from Web Client.
  • When document header field "MOB Posting MessageId" is empty the Mobile Message cannot be accessed from your posting context and only "staged" collected values from a previous try can be accessed. 
  • Re-trying from the Web Client will not populate "MOB Posting MessageId".
  • However, "staged" data that is committed will be available/visible when posting re-trying from Web Client.


Event flow

...

order

In the 3rd step you need to decide whether to subscribe to standard posting events.

...


Step 1: Define Steps

Define which Steps to collect

...

...

 

Step 2: Handle collected Step values

Stage collected date in custom tables/fields

...

...

 

Step 3: Standard posting

...

is triggered

Post and Clean-up staged data from 2nd step

...

TODO  Verify sample code

[EventSubscriber(ObjectType::CodeunitCodeunit::"Sales-Post", 'OnRunOnBeforeFinalizePosting''', false, false)]
 local procedure MyOnPostingSalesReturnOrder OnPostingSalesReturnOrder_OnRunOnBeforeFinalizePosting(var SalesHeader: Record "Sales Header"; var SalesShipmentHeader: Record "Sales Shipment Header"; var SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var ReturnReceiptHeader: Record "Return Receipt Header"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; CommitIsSuppressed: Boolean)
 var
     OrderValues: Record "MOB Common Element" temporary;
     MobRequestMgt: Codeunit "MOB NS Request Management";
     HeaderRecRef: RecordRef;
 begin
     if IsNullGuid(SalesHeader."MOB Posting MessageId"then
         exit;     // not Mobile WMS posting or retry from Web Client
     if (SalesHeader."Document Type" = SalesHeader."Document Type"::"Return Order") and (ReturnReceiptHeader."No." <> ''then begin
         HeaderRecRef.GetTable(SalesHeader);
         MobRequestMgt.GetOrderValues(SalesHeader."MOB Posting MessageId", OrderValues);
         MyOnPostReceiveOrder_OnPostingSalesReturnOrder(OrderValues, SalesHeader, ReturnReceiptHeader);
     end;
 end;


Example

if not IsNullGuid(MobilSessionData.GetPostingMessageId()) then
            exit;