Solved

API / Appointments / LocationID cannot be empty

  • 6 March 2024
  • 2 replies
  • 39 views

Question 

 

Where is LocationID field we see in our error message, and how can we stop it being empty?

 

Overview

 

Our system attempts to create Appointments for Service Orders via the Acumatica API. We are having a lot of trouble with the error:

LocationID' cannot be empty.; LocationID: 'LocationID' cannot be empty.

This error occurs in the API only, we do not see the error when creating appointments using the UI.  

Our software uses the API tries to take an existing Service Order, add an Appointment for it, and then set the Scheduled and Actual dates/times on the new appointment.  The ultimate goal is to enter an appointment log and create time cards automatically.  The error occurs when we try and set the dates and times.

 

Technical Detail

 

The working request to create the appointment looks like:

{
  "ServiceOrderNbr": {
    "value": "40054"
  },
  "ServiceOrderType": {
    "value": "TECH"
  },
  "BranchLocation": {
    "value": "DVM"
  },
  "Customer": {
    "value": "CSOUTHPAC"
  }
}

Which is mapped to the following fields in our custom endpoint:

  1. ServiceOrderNbr AppointmentRecords > Service Order Nbr.
  2. ServiceOrderType AppointmentRecords > Service Order Type
  3. Customer AppointmentRecords > Customer

The failing request to set the dates and times looks like :

{
  "AppointmentNbr": {
    "value": "40083-4"
  },
  "ServiceOrderLocation": {
    "value": "MAIN"
  },
  "ScheduledStartDate": {
    "value": "2024-03-06T00:00:00.000Z"
  },
  "ScheduledEndDate": {
    "value": "2024-03-06T00:06:00.000Z"
  },
  "ActualStartDate": {
    "value": "2024-03-06T00:00:00.000Z"
  },
  "ActualEndDate": {
    "value": "2024-03-06T00:06:00.000Z"
  },
  "ScheduledStartTime": {
    "value": "2024-03-06T00:00:00.000Z"
  },
  "ScheduledEndTime": {
    "value": "2024-03-06T00:06:00.000Z"
  },
  "ActualStartTime": {
    "value": "2024-03-06T00:00:00.000Z"
  },
  "ActualEndTime": {
    "value": "2024-03-06T00:06:00.000Z"
  }
}

Which is mapped to the following fields in our custom endpoint:

  1. AppointmentNbr AppointmentRecords > Customer
  2. ServiceOrderLocation Service Order Header > Location > LocationID (This was set up as a failed attempt to fix the bug)
  3. Actual Dates and Times Settings > Appointment Times > Actual Date And Time
  4. Scheduled Dates and Times Service Order Header > Delivery Notes
icon

Best answer by Laura02 6 March 2024, 02:32

View original

2 replies

Badge +18

Hello,

I wonder if the Location ID refers to the Customer’s location. When manually entering an Appointment, the customer’s location will likely default to MAIN. 
 

Here is a previous post that shows examples and lists possible meanings for “Location”: 


It seems like Customer Location is the most likely candidate.

Laura

Userlevel 7
Badge +12

Agree with @Laura02 the LocationID is the Customer Location but your API to create the Appointment is working and then your second API to update the Times is failing with this message.which makes me wonder is it trying to create a new appointment as I think your request to update the Times on the appointment should be sending the Service Order Type as well to find the correct appointment as Appointment Number is not unique 

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