Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Need help to finish my web service to create transfer orders using API

Posted on by 9
Hi, i am pretty new to AL programming language and i managed somehow to create a web service in business central to create new transfer orders using python, i can create transfer orders and add items to be transfered to it but i can't figure out how to post the transfer order so it will go to next stage (shipping, etc) using the API. The equivalent of pushing this button:
 ////
 
Here are the code for the 2 web services i use:
  1.  Page.TransferOrderService.al: 
    page 50119 /Transfer Order Service/{    PageType = API;    Caption = 'Transfer Order Service';    APIPublisher = 'EthanSorenson';    APIGroup = 'groupName';    APIVersion = 'v2.0';    EntityName = 'TransferOrderService';    EntitySetName = 'TransferOrderService';    SourceTable = /Transfer Header/;    DelayedInsert = true;    layout    {        area(Content)        {            group(General)            {                field(/No/; Rec./No./)                {                }                field(/TransferFromCode/; Rec./Transfer-from Code/)                {                }                field(/TransferToCode/; Rec./Transfer-to Code/)                {                }                field(/DirectTransfer/; Rec./Direct Transfer/)                {                }                field(/InTransitCode/; Rec./In-Transit Code/)                {                }                field(/PostingDate/; Rec./Posting Date/)                {                }                field(/ShortcutDimension1Code/; Rec./Shortcut Dimension 1 Code/)                {                }                field(/ShortcutDimension2Code/; Rec./Shortcut Dimension 2 Code/)                {                }                field(/AssignedUserID/; Rec./Assigned User ID/)                {                }                field(Status; Rec.Status)                {                }            }            group(Shipment)            {                field(/ShipmentDate/; Rec./Shipment Date/)                {                }                field(/OutboundWhseHandlingTime/; Rec./Outbound Whse. Handling Time/)                {                }                field(/ShipmentMethodCode/; Rec./Shipment Method Code/)                {                }                field(/ShippingAgentCode/; Rec./Shipping Agent Code/)                {                }                field(/ShippingAgentServiceCode/; Rec./Shipping Agent Service Code/)                {                }                field(/ShippingTime/; Rec./Shipping Time/)                {                }                field(/ShippingAdvice/; Rec./Shipping Advice/)                {                }                field(/ReceiptDate/; Rec./Receipt Date/)                {                }            }            group(/Transfer-from/)            {                field(/TransferFromName/; Rec./Transfer-from Name/)                {                }                field(/TransferFromName2/; Rec./Transfer-from Name 2/)                {                }                field(/TransferFromAddress/; Rec./Transfer-from Address/)                {                }                field(/TransferFromAddress2/; Rec./Transfer-from Address 2/)                {                }                field(/TransferFromCity/; Rec./Transfer-from City/)                {                }                group(Control17)                {                    field(/TransferFromCounty/; Rec./Transfer-from County/)                    {                    }                }                field(/TransferFromPostCode/; Rec./Transfer-from Post Code/)                {                }                field(/TrsfFromCountryRegionCode/; Rec./Trsf.-from Country/Region Code/)                {                }                field(/TransferFromContact/; Rec./Transfer-from Contact/)                {                }            }            group(/Transfer-to/)            {                field(/TransferToName/; Rec./Transfer-to Name/)                {                }                field(/TransferToName2/; Rec./Transfer-to Name 2/)                {                }                field(/TransferToAddress/; Rec./Transfer-to Address/)                {                }                field(/TransferToAddress2/; Rec./Transfer-to Address 2/)                {                }                field(/TransferToCity/; Rec./Transfer-to City/)                {                }                group(Control24)                {                    field(/TransferToCounty/; Rec./Transfer-to County/)                    {                    }                }                field(/TransferToPostCode/; Rec./Transfer-to Post Code/)                {                }                field(/TrsfToCountryRegionCode/; Rec./Trsf.-to Country/Region Code/)                {                }                field(/TransferToContact/; Rec./Transfer-to Contact/)                {                }            }            group(Control19)            {                field(/InboundWhseHandlingTime/; Rec./Inbound Whse. Handling Time/)                {                }            }            group(/Foreign Trade/)            {                field(/TransactionType/; Rec./Transaction Type/)                {                }                field(/TransactionSpecification/; Rec./Transaction Specification/)                {                }                field(/TransportMethod/; Rec./Transport Method/)                {                }                field(/Area/; Rec.Area)                {                }                field(/EntryExitPoint/; Rec./Entry/Exit Point/)                {                }                part(TransferLines; /Transfer Order Subform/)                {                    EntityName = 'TransferOrderLineService';                    EntitySetName = 'TransferOrderLineService';                }            }        }    }}
     
  2. Page.TransferLineService.al:
    page 50118 /Transfer Line Service/{    APIGroup = 'apiGroup';    APIPublisher = 'JeromeC';    APIVersion = 'v2.0';    ApplicationArea = All;    Caption = 'Transfer Line Service';    DelayedInsert = true;    EntityName = 'TransferLineService';    EntitySetName = 'TransferLineService';    PageType = API;    SourceTable = /Transfer Line/;    layout    {        area(content)        {            repeater(General)            {                field(documentNo; Rec./Document No./)                {                    Caption = 'Document No.';                }                field(itemNo; Rec./Item No./)                {                    Caption = 'Item No.';                }                field(quantity; Rec.Quantity)                {                    Caption = 'Quantity';                }                field(qtyToShip; Rec./Qty. to Ship/)                {                    Caption = 'Qty. to Ship';                }                field(status; Rec.Status)                {                    Caption = 'Status';                }            }        }    }}
    Note: the first one is not from me, credit to the author here: ethan-sorenson/TransferOrderService: Web Service for Transfer Orders (github.com)
 
Basically the first service create the transfer order and the other one add items to it. All is missing now is a way to post the order, can someone help me ? Thanks in advance !
Categories:
  • Verified answer
    LunatikDev Profile Picture
    LunatikDev 9 on at
    Need help to finish my web service to create transfer orders using API
  • Abdul Mateen Profile Picture
    Abdul Mateen 34 on at
    Need help to finish my web service to create transfer orders using API
    ​​​​​​​

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans