Internal_InvalidTableRelation

 The below error will be displayed when you are writing into a table in Business Central and the provided value is not accepted by Business Central. This is usually caused by those scenarios where the field is a picklist field in Business Central and it does not accept a value that's outside of the allowed list. In order to fix it, you would need to send the right one or build a formula to extract the data in the expected format: 


The REST service returned a status code that is not 20x - i.e. not OK - Status code received: 400 Bad Request Response body: {"error":{"code":"Internal_InvalidTableRelation","message":"The field Country/Region Code of table Contact contains a value (CANADA) that cannot be found in the related table (Country/Region). CorrelationId: ecb62be5-fde8-4310-9137-e46981d6eae1."}} Data Sent to REST service: {"Mobile_Phone_No_U2S":null,"Fax_No":null,"E_Mail":"abc@ymail.com","Type":"Person","First_Name":"Name","Surname":"Surname","Country_Region_Code":"Canada","County":null,"Company_No":"CT00000","Salesperson_Code":"INT'L","Home_Page":null,"ABC_Product_Groups":null}

You have 2 options: 

1. Turn the field into a picklist in both systems so the data will match;
2. Add a formula to extract the correct data from other tables/objects: ##DBLOOKUP('DESTDS','CountriesRegions','Name',"MailingCountry",'Code') where you perform a lookup on a destination table called "CountriesRegions" and if Name = MaillingCountry, the result will be the Code. And the 'Code' will be value that you need.