-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BadRequest on SalesReceipt Add when using SalesLineItemDetail #326
Comments
@nasai5533, I am receiving a different error, I am including the Line.Detail Type = LineDetailTypeEnum.SalesItemLineDetail. Would you mind sharing your code to create a Sales Receipt? |
You have to both set the DetailType and set DetailTypeSpecified to true |
Ah yes! That works! Weird, but o.k., thanks so much! |
No problem! And yes, it's a paradigm sometimes used in languages which don't allow for nullable value types. In the case they receive a call from you where the value for the DetailType property has been left at its default value, they want to be sure you actually intended to use the default value rather than forgot to set it. Because .NET allows for nullable value types, they could have easily set the type of the property to LineDetailTypeEnum? or Nullable and throw the exception when they receive null. DetailTypeSpecified would be redundant in this case and they could safely remove it. But this is all doubly weird because they could easily just inspect the type of the object you assigned to AnyIntuitObject and get rid of both properties. The inclusion of this kind of enum at all is a paradigm for languages that don't make the use of static typing. |
I get the following exception when using a SalesLineItemDetail for AnyIntuitObject on a Line when adding a SalesReceipt: BadRequest. Details: Required parameter Line.SalesItemLineDetail is missing in the request
This appears to happen when I use the SalesItemLineDetail object without setting any of its properties. If I set any property, say ServiceDate and ServiceDateSpecified, it works. Without setting a property, the object gets serialized as
<SalesLineItemDetail/>
, which for some reason gets rejected. Since according to the documentation all properties of SalesItemLineDetail are optional, I believe the intended functionality should be for an empty SalesItemLineDetail to be accepted.This works:
AnyIntuitObject = new SalesItemLineDetail() { ServiceDate = DateTime.Now, ServiceDateSpecified = true }
This works:
AnyIntuitObject = new SalesItemLineDetail() { Qty = 1, QtySpecified = true }
This does not work:
AnyIntuitObject = new SalesItemLineDetail()
The text was updated successfully, but these errors were encountered: