Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

AL scripting Purchase line thows error : Internal_InvalidTableRelation

Posted on by 7
Hello,

I want to create Purchase Credit Memo.

First I crate Purchase Header for that and that is getting created successfully and I get a document no.

using same document no. I try to create a Purchase Line. and that gives me error :
 
error: {
  code  :  Internal_InvalidTableRelation,
  message:  The field Document No. of table Purchase Line contains a value (38212) that cannot be found in the related table (Purchase Header)
}

Purchase Header:
 

Purchase Line :




Can someone please check above and help me understand why this error is coming ? as I have Record in Purchase Header but still error says Header Record not found.

Let me know if more details required.

Thanks.
  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 11,244 User Group Leader on at
    AL scripting Purchase line thows error : Internal_InvalidTableRelation
    Hi,
     
    Use deep insert with $expand parameters.
     
    How to use $expand parameters with API - https://youtu.be/i0luLg2vfgk
     
    Regards,
    Saurav Dhyani
  • gdrenteria Profile Picture
    gdrenteria 3,620 Super User on at
    AL scripting Purchase line thows error : Internal_InvalidTableRelation
    Hi
    I am giving you a link where the exercise is done but with a sales document, I hope it can give you some light on what can happen to you
    BR
    GR

Helpful resources

Quick Links

Can you answer this forum question?

You could make someone's day!

Community Newsletter - May 2024

Kudos to our community stars!

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283,632 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 224,528 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Featured topics

Product updates

Dynamics 365 release plans