web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

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

How to access Jobs from Custom API to Update/Patch data

(0) ShareShare
ReportReport
Posted on by 10

Hey, I created a custom API for Jobs to be able to access more data besides the standard ones I found in company/projects (which are only data.context, data.etag, id, number, displayname).

This worked fine so far but now I am working on a flow that should edit some specific data. I thought I can get the specific data by working with a filter (e.g. company/ProjectAPI?$filter= No eq '190614'). I can access the data but I cannot patch it. I found out that I have to put this "If-Match" command in my header together with my etag. But this won't work anymore when I use the above URL. I tested it with the original Microsoft Endpoint (company/projects(specific project id)). There it works fine. So I thought I somehow have to get this ID into my personal ProjectsID. But I haven't figured out a way to do this. I always get this notification: "Field 'Id' is marked for removal. Reason: This functionality will be replaced by the systemID field"

I googled a bit and read something about Line No.'s that are used. Can you guys tell me if I have to modify my API or in general be able to get my specific data set in order to patch it by using my If-Match header?

Best regards

I have the same question (0)
  • Suggested answer
    Mohamad Vajid Profile Picture
    on at
    RE: How to access Jobs from Custom API to Update/Patch data

    Hello,

    Could you maybe look at the SalesOrders API example code that can be found on the DVD in this path?

    DVD\Applications\APIV1\Source\APIV1.Source.zip\src\pages\
    PAG20028.SalesOrders.al
    PAG20044.SalesOrderLines.al

  • Suggested answer
    Anks27 Profile Picture
    1,085 on at
    RE: How to access Jobs from Custom API to Update/Patch data

    Hello,

    I was facing the same issue while updating the purchase invoice record, I had no idea how can I make patch call so what I did is create one bound action and wrote code to modify the data, also added Document Number and Document Type as parameter and also I have added custom response.

    For this you need to create one custom page and need to expose all the fields and after that you need to create one custom function which take number as parameter as well write down the code which modify the record.

    Here is the example of bound action in business central:

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-creating-and-interacting-with-odatav4-bound-action

    Use this method if you don't find any other options, Let us know if you have any query related to this bound action.

    Mark as a verified if you found this answer useful.

  • nortonrome Profile Picture
    10 on at
    RE: How to access Jobs from Custom API to Update/Patch data

    Thanks for the comments. That seems like a huge work around.

    Do you guys know about any other solution? Maybe working with Line Numbers?

  • Suggested answer
    Anks27 Profile Picture
    1,085 on at
    RE: How to access Jobs from Custom API to Update/Patch data

    Hello,

    I have one more solution, follow below steps and let me know if it works for you or not.

    1).Get the record by using filter using web service as below image (as per your requirement).

    content.png

    2) Get the value of @Odata.etag and add into parameters as below image.

    content-_2800_1_2900_.png

    3) Now send Patch request with filter as below image.

    content-_2800_2_2900_.png

    Signed,Sealed and Delivered.

    Don't forget to help the community by verifying the answer and Liked it if your question has been answered. It will let others know that the topic has verified answer.

    Thanks & Regards,

    Ankit Shah

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,255

#2
Sumit Singh Profile Picture

Sumit Singh 2,665

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,401

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans