Adding APInvDtl after creating APInvHead failing with REST API

I’m using the AddToAPInvoices REST method to create an APInvoice. When creating the head item, it runs fine, but when I try to attach an APInvDtl collection, I’m unable to do so because it requires a DataServiceCollection rather than just an array or list of APInvDtl.

So I decided to try to add them in different steps, however, when doing so I’m getting this exception:

{"HttpStatus":400,"ReasonPhrase":"REST API Exception","ErrorMessage":"There is no UOM Selected.","ErrorType":"Ice.Common.BusinessObjectException","ErrorDetails":[{"Message":"There is no UOM Selected.","Type":"Error","Table":"APInvDtl","Program":"Epicor.RESTApi.Common.dll","Method":"ThrowUpdateExtException","ColumnNumber":17,"LineNumber":27}],"CorrelationId":"351d9aea-d649-440f-9da9-b325318f25a0"}

I’m not quite sure what property this references in an APInvDtl or where it even comes from. Can someone explain to me why this exception is being thrown, what it’s referencing and, if possible, how to add an APInvDtl collection to my APInvoice so I can do this all in one step rather than two?

UOM (Unit of Measure) is required when entering an invoice line. According to the error message, this value hasn’t been provided.

I don’t see that property on the APInvDtl object. Do you know if it’s called something else?

Look for IUM and PUM.

IUM = Inventory Unit of Measure (Our Unit of Measure)
PUM = Purchasing Unit of Measure (Supplier Unit of Measure)

1 Like

Awesome, thank you

I’m now getting this exception:

{"HttpStatus":400,"ReasonPhrase":"REST API Exception","ErrorMessage":"Invalid Line Amount.","ErrorType":"Ice.Common.BusinessObjectException","ErrorDetails":[{"Message":"Invalid Line Amount.","Type":"Error","Table":"APInvDtl","Program":"Epicor.RESTApi.Common.dll","Method":"ThrowUpdateExtException","ColumnNumber":17,"LineNumber":27}],"CorrelationId":"2c1f461b-19d6-4762-9d5c-3aa3d79779cd"}

Another property that isn’t in the APInvDtl class.

Nevermind, I figured it out. Had to set the LineType to “R”

1 Like