Web service - OData option field

foo_bar
Member Posts: 91
Hello,
we have an external program, that is communicating with navision through OData webservice.
We have a problem while trying to create a comment record, where we have to define the "table data" field which is an option field.
This is the payload that we send:
This is the response that we get
Seems to mee that he is not validating the table_name option field.
Do I have to format this in a special way?
thank you,
Lorenzo
we have an external program, that is communicating with navision through OData webservice.
We have a problem while trying to create a comment record, where we have to define the "table data" field which is an option field.
This is the payload that we send:
{ "Table_Name": "Vendor", "Line_No": "2", "No": "S00001" }
This is the response that we get
{ "odata.error": { "code": "", "message": { "lang": "en-US", "value": "The field No. of table Comment Line contains a value (S00001) that cannot be found in the related table (G/L Account)." } } }
Seems to mee that he is not validating the table_name option field.
Do I have to format this in a special way?
thank you,
Lorenzo
0
Best Answer
-
I've come to the conclusion, that the problem is not the option field itself.
But the order or way of processing the fields?
If I send this as a payload:{ "Table_Name": "Vendor", "Comment": "test comment" }
I get this as result:{ "Table_Name": "Vendor", "No": "S00001", "Line_No": 150000, "Date": "2016-10-08T00:00:00", "Comment": "test comment", "Code": "", "ETag": "48;YQAAAACLAgAAAAJ7/1MAMAAwADAAMAAxAAAAAIfwSQIAAAA=8;186228330;" }
So my problem is that the "Table_Name" field is not being validated before the "No" field is being filled?0
Answers
-
Please try passing integer value for the "Table Name" field. For Vendor I think you can pass the value 2 and try.
P.s- 2 is the index of Vendor in "Table Name" option field.0 -
Hello,
thx for your suggestion, but i've forgot to mention that i've allready tried that, same result.0 -
I've come to the conclusion, that the problem is not the option field itself.
But the order or way of processing the fields?
If I send this as a payload:{ "Table_Name": "Vendor", "Comment": "test comment" }
I get this as result:{ "Table_Name": "Vendor", "No": "S00001", "Line_No": 150000, "Date": "2016-10-08T00:00:00", "Comment": "test comment", "Code": "", "ETag": "48;YQAAAACLAgAAAAJ7/1MAMAAwADAAMAAxAAAAAIfwSQIAAAA=8;186228330;" }
So my problem is that the "Table_Name" field is not being validated before the "No" field is being filled?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions