Hello all,
I had this customer requirement to implement in BC24 OnCloud:
Create a new sales order + sales lines using the same API call. This works and the response returns all the information that was created successfully (Both information about the Header and the lines).
I used the REST API URL to deep insert this document and made a copy of Microsoft's APIV2 pages regarding sales documents (Page 30028 "APIV2 - Sales Orders" and Page 30044 "APIV2 - Sales Order Lines").
However, the requirement changed. Now I need to be able to:
Insert the Sales Header
Inser the sales lines
After inserting each Sales Line I have to create X amount of vouchers on another table. (I wrote code on the OnInsert trigger of the Sales Line table so this is done through code).
Return all information including these vouchers (related to that Sales HEader document) created during the API call (in the JSON response).
All in the same API call!
I'm relatively new to this API shenanigans and frankly multiple deep inserts are still a bit overwhelming.
So I ask, is this even possible?
Or should I tell the customer to separate some functionalities?
Thanks in advance.
EDIT: We opted for separating the Insert and create logic from the return logic. So the customer will have to consume the API page and insert the sales order and then my code will create X amount of vouchers (In the same call).
Then they'll have to call the same API page but with GET method and ?expand parameter to get all the info they need.
0