Solved

Appointment List gives error when including Staff in REST API

  • 13 November 2023
  • 5 replies
  • 90 views

Badge

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)"
}
 

 

 

icon

Best answer by RohitRattan88 13 November 2023, 22:05

View original

5 replies

Userlevel 7
Badge +4

@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

Badge

@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.

Userlevel 7
Badge +4

@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.

Badge

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?

Userlevel 7
Badge +4

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

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