Solved

Unable to update AnctualQty field in Appointments Through Postman

  • 23 January 2024
  • 4 replies
  • 64 views

Userlevel 2
Badge

Hello Community!!,

Using SalesDemo, I am trying to add/update One Line item in Appointment Details with ActualQty, having Line type as "Non-Stock Item" through Postman PUT call using the “Appointment” EndPoint.

 

Add Scenario: 

  1. If the ActualQty is not included in the JSON request or if added as null then ActualQty is saving as 1.00 by default.
  2. But when I try to insert any value for ActualQty field I am getting an error as "exceptionMessage": "An error occurred during processing of the field Qty: Specified cast is not valid..".

Update scenario: 

  1. If the ActualQty is not incuded in the JSON request then the other fields are updating with out any error.
  2. If the ActualQty value is null then getting "error": "'BaseEffTranQty' cannot be empty.; 'BaseEffTranQty' cannot be empty.; BaseEffTranQty: 'BaseEffTranQty' cannot be empty.". Tried including the BaseEffTranQty but no fields are udpating.
  3. If the AcutalQty has any value such as 2, 2.0, 2.000000 or “2” then getting an "exceptionMessage": "An error occurred during processing of the field Qty: Specified cast is not valid..". 

 

PUT Callhttp://localhost/SalesDemo/entity/Default/20.200.001/Appointment?$expand=Details

JSON request :
 

{

  "AppointmentNbr": {

    "value": "005807-1"

  },

  "ServiceOrderType": {

    "value": "SUPP"

  },

  "Details": [

    {

      //"id": "269ad423-1798-ee11-aa65-c8f750455784",

      "LineType": {

        "value": "Non-Stock Item"

      },

      "InventoryID": {

        "value": "CARRENT"

      },

      "Description": {

        "value": "Car and vehicle charges"

      },

      "ActualQty": {

        "value": 2.000000

      },

      "BillableQty": {

        "value": 1.000000

      },

      "EstimatedQty": {

        "value": 1.000000

      },

      "note": {

        "value": "Notes for testing from Postman"

      }

    }

  ]

}

 

Thank you.

 

icon

Best answer by Troy Vars 24 January 2024, 15:31

View original

4 replies

Userlevel 4
Badge +2

Since ActualQty on this Entity is a Decimal you need to send 2.00m or 2.00M as your value 

This is one of these little tricks from C# and .Net

See this article

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types

 

Userlevel 2
Badge

Sorry @Troy Vars, we tried the sloution you were providing but the issue still presists.
Tried with this combinations 2.00m, 2.00M,”2.00m”,”2.00M”.
I think the issues is not realted to literals because as you see the BillableQty and EstimatedQty also decimal types same as the ActualQty these two fields are saving without literals.
 

 

Userlevel 4
Badge +2

Hi Dinesh, I tried this myself on 20.200.001, 22.200.01 and 23.200.01 all failed.

Then I noticed:

The mapped field for Actual Qty is Qty on the Default 20.200.001 Endpoint, this field is listed as an unspecified data type in the DAC Browser

I extended the Endpoint and the Appointment Entity 

Then Populated Actual Quantity field from Details object

Updated my JSON body with the ActualQuantity field and removed ActualQty

I was then able to add the Line to the appointment as long as it was in status that allow the Actual Quantity to be modified like the In Process Status

from the DAC Schema Browser

and dac class declaration

 

Userlevel 2
Badge

Thank you @Troy Vars, it works as expected, Intially the ActualQty was auto updating to 1.00 for appointments based on status. So I was misguided thinking it was the correct field but after your answer I have updated my Entity and the Acutal Qunatity is updating as expected. 


Thanks a lot...😊 it worked like a charm😁.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved