Insert Subform data in Card page by web service
sage
Member Posts: 29
Hi all helper,
I use NAV2013R2 and have a problem insert Subform data in Card page by web service and got this error.
:!: "The field No. of table Sales Line contains a value (1000) that cannot be found in the related table (Standard Text)." :!:
I guess because it's a field that have to validate from "Type" field and don't know how to insert it.
I attempted to insert line first and use service.Update() but the result is the same.
Any suggestion would be appreciate. Thank you.
I use NAV2013R2 and have a problem insert Subform data in Card page by web service and got this error.
:!: "The field No. of table Sales Line contains a value (1000) that cannot be found in the related table (Standard Text)." :!:
I guess because it's a field that have to validate from "Type" field and don't know how to insert it.
I attempted to insert line first and use service.Update() but the result is the same.
using WebService;
class Program
{
static void Main(string[] args)
{
string custNo = "10000";
string custName = "Name - 10000";
string itemNo = "1000";
// Create instance of service
SalesInv_Service salesInvoice;
SalesInv_Service_Service service;
salesInvoice = new SalesInv_Service();
service = new SalesInv_Service_Service();
service.UseDefaultCredentials = true;
salesInvoice.Sell_to_Customer_No = custNo;
salesInvoice.Sell_to_Customer_Name = custName;
Sales_Invoice_Line[] salesInvLine = new Sales_Invoice_Line[1];
salesInvLine[0] = new Sales_Invoice_Line();
salesInvLine[0].Type = WebService.Type.Item;
salesInvLine[0].No = itemNo; // <------ itemNo "1000" exist in Item Master
salesInvLine[0].Description = "xx";
salesInvoice.SalesLines = salesInvLine;
service.Create(ref salesInvoice);
Console.ReadLine();
}
}
Any suggestion would be appreciate. Thank you.
0
Comments
-
I'm not a C# expert, but did you try....
salesInvLine[0].Type = 2;If your work becomes a passion...
www.pardaan.com0 -
Hi denpar,
I got the compile error because wrong data type. It's not a Integer.0 -
Type is an option string...
Options
Blank (0) -> this means standard text
G/L Account (1)
Item (2)
Resource (3)
Fixed Asset (4)
Charge (Item) (5)
The error message implicates that the field 'Type' is blank. So when validating the field 'No' with value 1000, NAV is looking for a standard text with code 1000 instead of an item 1000....
In C/AL you can change the field type with the following code:
"sales invoice line".type := "sales invoice line".type::Item
or
"sales invoice line".type := 2;If your work becomes a passion...
www.pardaan.com0 -
Hi again Denpar,
Error is from C# not from C/AL.
I have no problem insert option string in C/AL but this is outside the C/SIDE and I don't know how to insert field which is an option.
I already tried
salesInvLine[0].Type = WebService.Type.Item;
This has no error but when I look in database it inserted blank.
and tried
salesInvLine[0].Type = 2;
It error when compile because wrong data type as I said.

0 -
As said I'm not a C# export... So I'm afraid I can't help you further

But I'm 100% sure the error you receive is a NAV error caused by validating the field 'No' with value 1000 while the field 'Type' is blank!If your work becomes a passion...
www.pardaan.com0 -
Thanks Denpar.
Although error still can't resolve, I'm very appreciated your help
0 -
AHA !!
Maybe I went to the wrong step. Now I can insert optionString by follow this instruction.
http://blogs.msdn.com/b/freddyk/archive ... d-rtm.aspx0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions