Hello! We develop a webservice for posting warehouse activity. We using following code: [ServiceEnabled] procedure PostAndPrint(var actionContext: WebServiceActionContext) var WhseActivLine: Record "Warehouse Activity Line";

Former Member

Hello!
We develop a webservice for posting warehouse activity.
We using following code:

[ServiceEnabled]
    procedure PostAndPrint(var actionContext: WebServiceActionContext)
    var
        WhseActivLine: Record "Warehouse Activity Line";
        WhseActivPost: Codeunit "Whse.-Activity-Post";
    begin
        WhseActivLine.Copy(Rec);

        WhseActivPost.PrintDocument(true);
        WhseActivPost.Run(WhseActivLine);

        actionContext.SetResultCode(WebServiceActionResultCode::Updated);
    end;


When we execute POST request for this action and send each line of WarehouseActivity as a body we see that for each line Business Central created separate Posted Warehouse Activity entity.
As i can see from AL "Whse.-Activity-Post"codeunit executed under Post action on Warehouse activity page.

But if we call Post action from Business Central itself (from UI) it created 1 Posted Warehouse activity entity with all lines linked to it.
Can someone tell us please, how we can achieve following behavior in AL?

Thanks in advance!
Related
Recommended