Announcements
Hi Experts,
We are making a API page to post warehouse shipment into posted warehouse shipment and get the new-created posted warehouse shipment lines back together.
The problem is when we called the api, it worked and did post the document, but it didn't return those new-created lines at the same time.
We were wondering if anyone who ran into the same situation, could please tell us how we can fix the table or the page we defined, so we can make the post-call return those new-created lines we want.
Thanks!
Here is the response of a post request:
REQUEST POST URL-bcinsider:7048/.../v1.0
/companies(f5a0e7d7-55f9-ea11-bb63-000d3a492461)
/postWhseShips?$expand=postedWhseShipLines
REQUEST BODY
{ "WhseShipmentNo": "WHSSHIP200040", "CreateInvoice": true }
RESPONSE
{ "@odata.context": "http://bcinsider:7048/BC/api/TrueCommerce/TRC/v1.0/$metadata#companies(f5a0e7d7-55f9-ea11-bb63-000d3a492461)/postWhseShips/$entity", "@odata.etag": "W/\"JzQ0O2sva1g4OW9SYjB1d2QrTDgvNlE2Zm9HOTRiMC9rZUNENXpFR0xDOWtvQlk9MTswMDsn\"", "no": 4, "WhseShipmentNo": "WHSSHIP200040", "CreateInvoice": true, "PostedWhseShipmentNo": "P-WHSSHIP200042", "PostedSalesShipmentNo": "S-SHPT103067", "PostedSalesInvoiceNo": "PS-INV103283", "postedWhseShipLines": [] // with no lines returned }
Here is our code:
table 70203602 TRCPostWhseShip { DataClassification = CustomerContent; Permissions = tabledata "Warehouse Shipment Header" = idmr, tabledata "Warehouse Shipment Line" = idmr, tabledata "Sales Header" = mr, tabledata "Sales Line" = mr; fields { field(70203500; "No."; Integer) { DataClassification = CustomerContent; AutoIncrement = true; Access = Internal; } field(70203501; WhseShipNo; Code[20]) { DataClassification = CustomerContent; } field(70203502; "Location Code"; Code[10]) { DataClassification = CustomerContent; } field(70203503; "Posting Date"; Date) { DataClassification = CustomerContent; } field(70203504; "Shipment Date"; Date) { DataClassification = CustomerContent; } field(70203505; CreateInvoice; Boolean) { DataClassification = CustomerContent; } field(70203506; PostedWhseShipmentNo; Code[20]) { DataClassification = CustomerContent; } field(70203507; PostedSalesShipmentNo; Code[1024]) { DataClassification = CustomerContent; InitValue = ''; } field(70203508; PostedSalesInvoiceNo; Code[1024]) { DataClassification = CustomerContent; InitValue = ''; } } keys { key(PK; "No.") { Clustered = true; } } var trigger OnInsert() var whseShipHeader: Record "Warehouse Shipment Header"; whseShipLine: Record "Warehouse Shipment Line"; postedWhseShipHeader: Record "Posted Whse. Shipment Header"; postedWhseShipLine: Record "Posted Whse. Shipment Line"; postedInv: Record "Sales Invoice Header"; postedInvLine: Record "Sales Invoice Line"; cuPostWhseShip: Codeunit "Whse.-Post Shipment"; lstSalesOrderNo: List of [Code[20]]; lstPostedSalesShipNo: List of [Code[20]]; lstPostedInvNo: List of [Code[20]]; begin if whseShipHeader.Get(Rec.WhseShipNo) then begin whseShipLine.SetRange("No.", Rec.WhseShipNo); if whseShipLine.FindSet() then repeat if (whseShipLine."Qty. to Ship" > 0) and (whseShipLine."Qty. to Ship" <= whseShipLine.Quantity) then begin cuPostWhseShip.SetPostingSettings(Rec.CreateInvoice); cuPostWhseShip.Run(whseShipLine); end; until whseShipLine.Next() = 0; end; end; }
page 70203621 TRCPostWhseShip { SourceTable = TRCPostWhseShip; DelayedInsert = true; Permissions = tabledata "TRCPostWhseShip" = rimd, tabledata "Posted Whse. Shipment Header" = idmr; PageType = API; APIVersion = 'v1.0'; Caption = 'postWhseShip', Locked = true; APIPublisher = 'TrueCommerce'; APIGroup = 'TRC'; EntityName = 'postWhseShip'; EntitySetName = 'postWhseShips'; layout { area(Content) { group(General) { field(WhseShipmentNo; Rec.WhseShipNo) { ApplicationArea = All; } field(CreateInvoice; Rec.CreateInvoice) { ApplicationArea = All; } field(PostedWhseShipmentNo; Rec.PostedWhseShipmentNo) { ApplicationArea = All; } field(PostedSalesShipmentNo; Rec.PostedSalesShipmentNo) { ApplicationArea = All; } field(PostedSalesInvoiceNo; Rec.PostedSalesInvoiceNo) { ApplicationArea = All; } part(TRCPostedWhseShipLinePart; 70203622) { ApplicationArea = All; Caption = 'postedWhseShipLines', Locked = true; EntityName = 'postedWhseShipLine'; EntitySetName = 'postedWhseShipLines'; SubPageLink = "No." = field(PostedWhseShipmentNo); } } } } }
page 70203622 TRCPostedWhseShipLinePart { SourceTable = "Posted Whse. Shipment Line"; PageType = ListPart; Permissions = tabledata "Posted Whse. Shipment Line" = r; layout { area(Content) { repeater(General) { field("No."; Rec."No.") { ApplicationArea = All; } field("Whse Shipment Line No."; Rec."Whse Shipment Line No.") { ApplicationArea = All; } field("Source No."; Rec."Source No.") { ApplicationArea = All; } field("Source Line No."; Rec."Source Line No.") { ApplicationArea = All; } field("Posted Source No."; Rec."Posted Source No.") { ApplicationArea = All; } } } } }
Thanks again!
Hi,
Thanks for your reply,
I did not get the Posted Warehouse Shipment Lines related to the Posted Warehouse Shipment (P-WHSSHIP200042).
Thanks again.
Hi,
Are you not getting any lines from Posted Warehouse Shipment Lines or you are not getting the recently Posted Warehouse Shipment Line ?
André Arnaud de Cal...
294,125
Super User 2025 Season 1
Martin Dráb
232,871
Most Valuable Professional
nmaenpaa
101,158
Moderator