Solved

Error in creating the employee via Rest API

  • 1 September 2022
  • 3 replies
  • 163 views

Userlevel 2

why this payload is giving me an Error:422 "error": "Inserting 'Address' record raised at least one error. Please review the errors.; CountryID: 'Country' cannot be empty.",

{
"Status": {"value": "Active"},
"EmployeeID": {"value": "CRIC123789"},
"EmployeeName": {"value": "Doe, Jane"},
"FinancialSettings":
{
"APAccount": {"value": "ACCOUNT123"},
"APSubaccount": {"value": "000000"},
"ExpenseAccount": {"value": "ACCOUNT456"},
"PaymentMethod": {"value": "CHECK"},
"PrepaymentSubaccount": {"value": "000000"},
"SalesAccount": {"value": "ACCOUNT789"},
"TaxZone": {}


},
"EmployeeSettings":
{
"BranchID": {"value": "CRIC012345"},
"Calendar": {"value": "NEWCAL1234"},
"CurrencyID": {"value": "USD"},
"CurrencyRateTypeID": {"value": "SPOT"},
"DepartmentID": {"value": "1"},
"EmployeeClass": {"value": "EMPCLASSNE"}
},
"ContactInfo":
{
"LastName": {"value": "Doe"}
},
"Address":
{
"CountryID":{"value":"India"}
}
}

icon

Best answer by farhanshaik 1 September 2022, 16:14

View original

3 replies

Userlevel 7
Badge

Thank you for sharing your solution with the community @farhanshaik !

Userlevel 2

Hi laura,

thanks for replying back..

 

i’ve resolved my issue and the problem was 

in APi’s

it is considering the “country” as the abbrebviation(IN) and not the “countryID

and also the object “Address” is a sub-object of “ContactInfo” whereas i was considering it as a different object itself

 

Here is the Correct Payload.. You can have a look at it

Acumatica create Employee payload:

{
    "Status": {"value": "Active"},
    "EmployeeID": {"value": "CRIC123789"},
    "EmployeeName": {"value": "Doe, Jane"},
    "FinancialSettings":
    {
        "APAccount": {"value": "ACCOUNT123"},
        "APSubaccount": {"value": "000000"},
        "ExpenseAccount": {"value": "ACCOUNT456"},
        "PaymentMethod": {"value": "CHECK"},
        "PrepaymentSubaccount": {"value": "000000"},
        "SalesAccount": {"value": "ACCOUNT789"},
        "TaxZone": {}
    },
    "EmployeeSettings":
    {
        "BranchID": {"value": "CRIC012345"},
        "Calendar": {"value": "NEWCAL1234"},
        "CurrencyID": {"value": "USD"},
        "CurrencyRateTypeID": {"value": "SPOT"},
        "DepartmentID": {"value": "1"},
        "EmployeeClass": {"value": "EMPCLASSNE"}
    },
    "ContactInfo":
    {
        "LastName": {"value": "Doe"},
        "Address":
    {
        "Country":{"value":"IN"}
    }
    
    }

    
}

 

 

Thank you

Badge +18

Hello, I am not a developer but I know when I manually choose a country in Acumatica, I need to use the official 2-digit abbreviation for the country, not the full name. Did you try IN , not ‘India’?

 

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