How to replicate Sales order as now one?

vinceliu666vinceliu666 Member Posts: 51

I try to create Sales Order Change page for the situation : When user makes sales order change they must entry data in the page (Sales Order Change) and waiting approval by team leader.

For the purpose ,I replicate the Sales Order include Table (SO Line Table ID 37) / Page as new one for Sales Order Change table (SO change Line Table 80001) / page .Then I got the error when complier it ...

Couse for the Rec (ID 80001) not equal Salesline3 (ID 37).

I could use those code to trans it for fix ERROR1

But how could I make the Rec := SalesLine3; ?
Because the TRANSFERFIELDS is not a public function in Rec. How could I do ?

Does anyone have any ideal?

LOCAL PROCEDURE SelectItemEntry@8(CurrentFieldNo@1000 : Integer);
ItemLedgEntry@1001 : Record 32;
SalesLine3@1002 : Record 37;
ItemLedgEntry.SETRANGE("Item No.","No.");
IF "Location Code" <> '' THEN
ItemLedgEntry.SETRANGE("Location Code","Location Code");
ItemLedgEntry.SETRANGE("Variant Code","Variant Code");

IF CurrentFieldNo = FIELDNO("Appl.-to Item Entry") THEN BEGIN
ItemLedgEntry.SETCURRENTKEY("Item No.",Open);
ItemLedgEntry.SETCURRENTKEY("Item No.",Positive);
ItemLedgEntry.SETFILTER("Shipped Qty. Not Returned",'<0');
+ OnSelectItemEntryOnBeforePageRunmodal(Rec,ItemLedgEntry,CurrentFieldNo)
IF PAGE.RUNMODAL(PAGE::"Item Ledger Entries",ItemLedgEntry) = ACTION::LookupOK THEN BEGIN

SalesLine3 := Rec; --->ERROR1

IF CurrentFieldNo = FIELDNO("Appl.-to Item Entry") THEN
SalesLine3.VALIDATE("Appl.-to Item Entry",ItemLedgEntry."Entry No.")
SalesLine3.VALIDATE("Appl.-from Item Entry",ItemLedgEntry."Entry No.");

Rec := SalesLine3; --->ERROR2


  • Options
    Slider123Slider123 Member Posts: 7
    Is creating a whole new table necessary to handle this pending approval stage? I think you could add another boolean on the Sales Header/Sales Line table such as "Pending Change Approval". You could subscribe to an event OnBeforePost to prevent the Sales Orders being processed while in this state and create a Cue to provide quick navigation to the Sales Orders in this state. Finance Members could press an action which removes this flag from the order and allows it to be processed again.

  • Options
    vinceliu666vinceliu666 Member Posts: 51
    Hi Slider

    I want to keep the sales order line field value before and after change. For the purpose, I have to replicate sales order which user want to change as source and let user to modify the field on sales order line .

    If I use the flag on Sales Order Line, how could let user's leader know which field has been changed?

  • Options
    AluanAluan Member Posts: 162
    edited 2021-01-26
    Hallo vinceliu666,
    what version are you using?
    The Codeunit 6620 - Copy Document Mgt. (Function CopySalesDoc) should help.

    As Slider already wrote, do you really need a new table? Another approach would probably, to work with the Sales Order Archive. You could create a new version in the Sales Order Archive, so you don't need a new table and you can use the standard functions and you can see all changes.
  • Options
    vinceliu666vinceliu666 Member Posts: 51
    Hi Aluan:

    Thanks for your suggestion. Navision version is 2016 . I thought Sales Order Archive is a good approach but it's hard to check which field has changed.
  • Options
    Slider123Slider123 Member Posts: 7
    Hello, you could also create a sub page which displays change log entries for the Sales Order filtered by any changes made after the last time it was approved.
Sign In or Register to comment.