Skip to main content
Solved

Update Appointment details using PUT Request not working

  • December 19, 2023
  • 5 replies
  • 257 views

Forum|alt.badge.img

Hi Community,

I am trying to add One Line item in Appointment Details tab having Line type as "Non-Stock Item" through Acumatica.RESTApi using PutEntityAync from C#. 
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.." 


But the datatype of that field is decimal and I am trying to insert same as Decimal.If I keep ActualQty as Null then the remaining fields are inserting as expected.
And while updating any Non-Stock Item if I give ActualQty any input then I am getting same error.

Here if I keep ActualQty as Null then I am getting "exceptionMessage": "Nullable object must have a value". 

But If I remove ActualQty filed from the request, then the update is working fine.
Remaining Decimal type fields are updating but facing this issue with ActualQty.


Also while adding a new line in details, I’m unable to insert AcutalQty thorugh Postman or API PUT call.
If I pass ActualQty as null then the remaining fields are adding but when try to insert any value in AcutalQty facing the same errors β€œSpecified cast is not valid..”. 

Best answer by Troy Vars

This is an issue with Integration Webservice Endpoint as the Actual Quantity field is pointing to an unspecified field called QTY

Solution to this is on this post here 

 

View original
Did this topic help you find an answer to your question?

5 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3409 replies
  • December 19, 2023

@DineshJ Can you please share your API request here?


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 18 replies
  • December 19, 2023

Hi @Naveen Boga  thank you for quick reply, 

This is the PUT call URL using in Postman.
PUT: http://localhost/AcumaticaERP/entity/Default/20.200.001/Appointment?$expand=Details
BODY:  

{
    "AppointmentNbr": {"value": "ABCD123456-1"},
     "ServiceOrderType": {
        "value": "ABCD"
    },
    "Details": [
        {
        "id": "111ab111-2222-bc22-c23-c8f750455784",

            "LineType": {
            "value": "Stock"
        },
        "InventoryID": {
                    "value": "AB_AB_ABCD"
                },
         "ActualQty": {
                    "value": 2.000000
                },
                "BillableQty": {
                    "value":1.000000
                },
                "EstimatedQty" : {
                    "value":1.000000
                },
             "Note": {
            "value": "For Testing from Postman"
        }
        }
    ]
}

DAC schema data type

I tried with few scenarious  where status of an Appointment is Inprogress or completed

This is the code I’m using in API:

public async Task<Acumatica.Default_20_200_001.Model.Appointment> AddStock(string token, requestDTO request)
        {
                string expand = "Details";
                var newDetail = new AppDetails
                {
                    ID = request.Id,
                    LineType = request.LineType,
                    InventoryID = request.InventoryId,
                    EstimatedQty = request.EstimatedQty,
                    BillableQty = request.BillableQty,
                    ActualQty = request.ActualQuantity,
                    Note = request.Note
                };
                var updatedAppointment = new Acumatica.Default_20_200_001.Model.Appointment
                {
                    AppointmentNbr = request.AppointmentNbr,
                    ServiceOrderType = request.ServiceOrderType,
                    Details = new List<AppDetails> { newDetail }
                };
                AppointmentApi appApi = GetApiClient(token, apiClient);
                Acumatica.Default_20_200_001.Model.Appointment result = await appApi.PutEntityAsync(updatedAppointment, expand: expand);
                return result;
        }

For both Postman and API the result is same as below.

Scenario 1: If the AcutalQty is removed from the code/body the rest of the fields are updating as expected.
Scenario 2: If the ActualQty is null then getting : "exceptionMessage": "Nullable object must have a value". 
Scenario 3: if the ActualQty is provided with any value such as 2, 2.0, 2.000000, β€œ2.0”, 0 then getting : "exceptionMessage": "An error occurred during processing of the field Qty: Specified cast is not valid..

While adding a new line in the details tab from API
Scenario 1: if the ActualQty is null then new line is adding as expected 
Scenario 2: if the ActualQty is provided with any value such as 2, 2.0, 2.000000, β€œ2.0”, 0 then getting : "exceptionMessage": "An error occurred during processing of the field Qty: Specified cast is not valid..


Forum|alt.badge.img+6
  • Captain II
  • 558 replies
  • December 20, 2023

This isn’t a fix but when I was dealing with a third party customization that had various issues when trying to insert/update through the API. So what I ended up doing was to create an custom field to capture and display the contents of the problematic field and I add underlying business logic to allow me to pass the value of my custom field to the actual field so all business logic is maintained.


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 18 replies
  • January 3, 2024

Hi @Django Thank you,  but I prefer using the same field I want to know the correct reason why it is not working so is there any way I can find it or any other way we can do it like a work arround without adding a new field.

 


Troy Vars
Semi-Pro I
Forum|alt.badge.img+1
  • Semi-Pro I
  • 54 replies
  • Answer
  • January 25, 2024

This is an issue with Integration Webservice Endpoint as the Actual Quantity field is pointing to an unspecified field called QTY

Solution to this is on this post here 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings