Skip to main content
Solved

Appointment List gives error when including Staff in REST API

  • November 13, 2023
  • 5 replies
  • 115 views

Forum|alt.badge.img

I am using REST Client to make API calls to default 20.200.001 endpoint. When I include Staff in my Select input I am getting an error. If I do not include “Staff/Description” in my Select, I get the results.

 

using Acumatica.Default_20_200_001.Api;
using Acumatica.RESTClient.Client;


public async Task<List<Acumatica.Default_20_200_001.Model.Appointment>> GetAppointmentList(string token)
        {
            if (apiClient.Token == null)
                apiClient.Token = new Acumatica.Auth.Model.Token();
            apiClient.Token.Access_token = token;
            apiClient.Token.Token_type = "Bearer";
            AppointmentApi appointmentApi = new AppointmentApi(apiClient);
            string expand = "Staff";
            string select = "ActualDuration,ActualEndDate,ActualEndTime,ActualHandleManually,ActualServiceDuration,ActualStartDate,ActualStartTime,AppointmentNbr,Description," +
                "Location,ScheduledDuration,ScheduledEndDate,ScheduledEndTime," +
                "ScheduledStartDate,ScheduledStartTime,ServiceOrderNbr,ServiceOrderType,Status,WorkflowStage," +
                "Staff/Description";//,Staff/StaffMember";
            string filter = "ServiceOrderType eq 'TMVT'";
            List<Acumatica.Default_20_200_001.Model.Appointment> appointments = await appointmentApi.GetListAsync(select: select, expand: expand, filter: filter, top: 10);
            return appointments;
        }

Error:

Error 500 calling GetList: Internal Server Error 
 An error has occurred. : An error occurred during processing of the field IsCustomerOrCombined: Input string was not in a correct format.. : {
  "message": "An error has occurred.",
  "exceptionMessage": "Input string was not in a correct format.",
  "exceptionType": "System.FormatException",
  "stackTrace": "   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)\r\n   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)\r\n   at System.Byte.Parse(String s, NumberStyles style, NumberFormatInfo info)\r\n   at PX.Data.PXXmlDataRecord.GetBoolean(Int32 i)\r\n   at PX.Data.Extensions.GetValue(PXDataRecord record, Int32 i, Type type)\r\n   at PX.Data.PXDBCalcedAttribute.RowSelecting(PXCache sender, PXRowSelectingEventArgs e)\r\n   at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly)"
}
 

 

 

Best answer by RohitRattan88

@rajeshmishra90 During my testing, I could not get list of Appointments when $expand on Staff.

I would suggest creating a Generic Inquiry, pull in the required fields, and expose it via OData. then you should be able to $get the list, do the filtering etc.

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

5 replies

RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • 253 replies
  • November 13, 2023

@rajeshmishra90 

During my testing I found that you might need to GET record using KEY field for these requirements:

Ref: https://help.acumatica.com/(W(272))/Help?ScreenId=ShowWiki&pageid=52c97a83-1fa1-40e9-8219-52a89a91f2da


Forum|alt.badge.img
  • Author
  • Freshman II
  • 11 replies
  • November 13, 2023

@RohitRattan88 

My requirement is to get the list of appointment based on the assigned staff member name. I am not trying to get details of 1: appointment but a list of appointment. The example you mentioned is for getting details for 1: appointment.


RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • 253 replies
  • Answer
  • November 13, 2023

@rajeshmishra90 During my testing, I could not get list of Appointments when $expand on Staff.

I would suggest creating a Generic Inquiry, pull in the required fields, and expose it via OData. then you should be able to $get the list, do the filtering etc.


Forum|alt.badge.img
  • Author
  • Freshman II
  • 11 replies
  • November 14, 2023

Yes, that is additional work we will have to do in case there is no other option. But  I have similar requirement for many other entities so I was looking for an explanation to understand why it is happening? If it’s supported or not supported?


RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • 253 replies
  • November 14, 2023

@rajeshmishra90 Filtering on detail/child entity is not currently supported for contract based API


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