Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Get Production Journal Lines in ODataV4 (or through API)

(0) ShareShare
ReportReport
Posted on by 77

Hello, I am working on a program that would automatically update the Production Journal for our production orders. Right now I'm trying to get the production journal lines for the production order via ODataV4 (as below), but I am having trouble.

pastedimage1653859796839v1.png

I've created a web service, but when I use it, the results are empty. The web service looks like this:

pastedimage1653858691764v1.png

Response I get:

{
   "@odata.context": myURL,
   "value": []
}

I believe you have to specify a journal in order to get journal lines, which may be the cause of the problem. I've tried to rectify this by adding ?$filter=xx like so myURL?$filter=Order_No. eq 'ORDERNUMBER' using this page but I just get an error in the response.

I've also tried tried to use the API to get the journal lines using this page. But it says you need to have the journal ID in the URL, I can't figure out what that should be. I've tried putting in the ID of the production order, the name of the production order, doesn't work.

pastedimage1653859227670v2.png

If anyone has ideas I would love to hear them, I'm having a tough time with this. Thanks!

  • Guy McKenzie Profile Picture
    1,330 on at
    RE: Get Production Journal Lines in ODataV4 (or through API)

    I’m pretty sure the production journal only exists temporarily while you have it open in BC.

    I think you’ll find this requirement more easily met by writing to the output and consumption journals.

  • Suggested answer
    JAngle Profile Picture
    83 on at
    RE: Get Production Journal Lines in ODataV4 (or through API)

    I did this video a while ago which might go along with the other you have found: https://youtu.be/6VUNCVKCwM4

    The easiest way to create an api page is to install a vs code extension called AZ AL. It has a wizard based method for creating objects. You just fill in the unique pieces of info. At the time of the video the v1 standard api didn’t include the contact table so I use a none custom table in that scenario

  • matthewjd24 Profile Picture
    77 on at
    RE: Get Production Journal Lines in ODataV4 (or through API)

     JAngle Robert Jolliffe Thank you for your replies. Yes I am working on a shop-floor application that we can use to update BC with the current status of our production orders. I realized I was having trouble finding the right table where the progress is tracked, once I found it I made a web service and can get the data from it.

    Now my task is to POST new lines to it, so I am going to use your advice and try to make a custom API to do that. This is my first time doing it, do you have any advice for learning to do it? Here is a video I'm working with right now https://www.youtube.com/watch?v=dp_mzqzNvPA. I assume I do not need to create a custom table, just a new page with 'source table' set to the table I want to update (Capacity Ledger Entry). Thanks!

    pastedimage1654102596640v1.png

  • Suggested answer
    JAngle Profile Picture
    83 on at
    RE: Get Production Journal Lines in ODataV4 (or through API)

    With the odata page use the journal template and batch as filters. The primary key fields need satisfying for it to pick up your data. The api page is purely for financial journals so that is no good to you.

    I agree with the latest remark that a custom query/page is often the best way so you can use the information in a variety of paths in an optimised way. I’ve previously completed your scenario by doing just that.

  • Robert Jolliffe Profile Picture
    859 on at
    RE: Get Production Journal Lines in ODataV4 (or through API)

    I'd probably try creating a new, very simple page for this and publishing that page instead of the standard one. You want a page that when you run it "pops open" without any prompts before.  I believe this page requires you to pick a batch first.

    Creating a page in AL that defaults to a batch would make it much easier to do this.

    I assume you want to use a Power App or a custom application to collect data from the shop floor and push it into BC with web services?  It might also make sense to write a SOAP web service function in a Code Unit that you call and pass the information into, which then checks to make sure it's all correct and sends back a simple error code.

    Not sure if that helps.

    -Rob

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,017 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,852 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans