Assign a value from Gen Business Posting Group Table.

mysamzamysamza Posts: 45Member
I have got Gen Bus. Posting Group field showing on the subform of Sales Order. This Subform is also showing Location Code for the Line.

I am attempting to write a logic as such that if the User selects Location Code as DROPSHIP, the Gen Bus. Posting Group should be LOCAL-DROPSHIP.

LOCAL-DROPSHIP is a record in the Gen. Bus. Posting Group. I have created it before writing this code. However, it would not assign to my rec.Gen Bus. Posting Group.

Here is the code on the Subform;
modify("Location Code")
        {
            trigger OnAfterValidate()
            var
                recLocation: Record Location;
                recCustomer: Record Customer;
                recSalesLine: Record "Sales Line";
                recGenPosting: Record "Gen. Business Posting Group";

            begin
                recGenPosting.Get('LOCAL-DS');
                if rec."Location Code" = 'DROPSHIP' then begin
                    Message(recGenPosting.Code);
                   // Validate("Gen. Bus. Posting Group", recGenPosting.Code);
                    Rec."Gen. Bus. Posting Group" := recGenPosting.Code;
                    CurrPage.Update();
                end;
            end;
        }

Answers

  • rnjbngrnjbng Posts: 80Member
    Are you using page extension or modifying the standard nav page sales order subform. If you are using page extension then you have to modify the record and pass the value to the sales line.

    Validate("Gen. Bus. Posting Group", recGenPosting.Code);
    rec.modify
Sign In or Register to comment.