Inserting Quote Lines with a LineType of "Comment" via Web Services into BC365

73 Views Asked by At

For a project I am working on linking to Microsoft Dynamics 365 Business Central (Cloud), I'm attempting to insert a Quote Line via Web Services that has a LineType of "Comment", but am getting various errors which indicate that I should be providing an ItemID even though this LineType does not relate to an Item.

I've previously successfully inserted normal lines either by not providing the LineType (in which case it assumes the LineType is "Item") or by actually providing "Item" in that field.

The issue I'm having is that since the line I'm now attempting to insert is a comment, it is not related to an item so I have no GUID to map to the ItemID field, but I get the following response from the Web Service:

Invalid Request Data - 'ItemId' Invalid. The property 'ItemId's value is invalid - 'Guid' expected. Error Code: 512 Exception Code: 0

With this, I've checked the values of fields against existing "Comment" Quote Lines in BC365 and found that the GUID for those is 00000000-0000-0000-0000-000000000000 So I tried mapping that value to ItemID when inserting a "Comment" line, but I instead get the following error:

Business Central Request Failed - An Error was Returned. Application_DialogException. Item does not exist. CorrelationId: cfc26af5-1cc3-4fe9-ab39-ddfc76aba781. Error Code: 513 Exception Code: 0

I can't find any documentation on this Error Code, or in general what value should be provided in the ItemID field for instances where you'd want to insert a "Comment" instead of an "Item".

I've even tried using a GUID for a valid product, hoping it would pass the check but end up being ignored in favour of setting the line as a "Comment", however that yielded this response:

Business Central Request Failed - An Error was Returned. Internal_RecordNotFound. The Standard Text does not exist. Identification fields and values: Code='ITEM01' CorrelationId: f68c96d3-dcbf-4005-9b04-66989fb9c030. Error Code: 513 Exception Code: 0

Has anyone had any success with inserting a LineType other than "Item" into either Quote Lines, Order Lines, Invoice Lines or any other table in Microsoft Dynamics 365 Business Central (Cloud)? Or indeed got any suggestions on what else I could try?

0

There are 0 best solutions below