Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Deleting vendor invoice journal line using OData

(0) ShareShare
ReportReport
Posted on by 103

Hi, I am running into problem deleting journal lines. When I do the GET query below, it returns me the row of data that I'm expecting, but when I try to delete using the DELETE query below, I get an error that says "No resources were found when selecting for update". What am I doing wrong?

GET: 
https://{{HOST}}/data/VendInvoiceJournalLines?cross-company=true&$filter=dataAreaId eq '442' and JournalBatchNumber eq '002823' and LineNumber eq 1

DELETE:
https://{{HOST}}/data/VendInvoiceJournalLines(dataAreaId='442',JournalBatchNumber='002823',LineNumber=1)

  • Verified answer
    tl2022 Profile Picture
    tl2022 103 on at
    RE: Deleting vendor invoice journal line using OData

    I figured it out! I just needed to put cross-company after everything, outside of the parenthesis:

    https://{{HOST}}/data/VendInvoiceJournalLines(dataAreaId='442',JournalBatchNumber='002823',LineNumber=1)?cross-company=true

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Deleting vendor invoice journal line using OData

    I tried your query and it doesn't work from browser.

    pastedimage1684288434216v1.png

    But the query you have for Get works well. You can try both queries directly in browser to fetch data and see the difference. 

    Please use the below query to delete the record

    https://{{HOST}}/data/VendInvoiceJournalLines?cross-company=true&$filter=dataAreaId eq '442' and JournalBatchNumber eq '002823' and LineNumber eq 1

  • tl2022 Profile Picture
    tl2022 103 on at
    RE: Deleting vendor invoice journal line using OData

    Hi Mohit, so I tried that but the request is not working. I don't know what I am doing wrong:

    DELETE:

    https://{{HOST}}/data/VendInvoiceJournalLines(cross-company=true,dataAreaId='442',JournalBatchNumber='002823',LineNumber=1)

    Error:

    {

       "Message": "No HTTP resource was found that matches the request URI 'https://{{HOST}}/data/VendInvoiceJournalLines(cross-company=true,dataAreaId='442',JournalBatchNumber='002823',LineNumber=1)'. No route data was found for this request."

    }

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Deleting vendor invoice journal line using OData

    Hi, Can you try adding cross-company keyword in DELETE query as well. Probably, your user's default company is not 442.

    By default, OData returns only data that belongs to the user's default company. To see data from outside the user's default company, specify the ?cross-company=true query option. This option will return data from all companies that the user has access to.

    You can try your Delete query directly on browser and it will fail with this error 'No webpage was found for the web address'.

    Please use same as Get query and issue should be fixed. 

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans