Skip to main content
Solved

Error in creating the employee via Rest API

  • September 1, 2022
  • 3 replies
  • 226 views

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

Best answer by farhanshaik

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

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

3 replies

Laura02
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3132 replies
  • September 1, 2022

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’?

 


  • Author
  • Freshman II
  • 6 replies
  • Answer
  • September 1, 2022

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


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2759 replies
  • September 1, 2022

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


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