C# Web Service Error

boone
Member Posts: 23
I have become quite comfortable with my ability to import large amounts of data through NAV web service calls in C#. However, I've run into a strange error that I can't understand. Against my strongly voiced advice, my company's executives decided to budget to totaling accounts. NAV's native budget import obviously doesn't support totaling accounts, but it is possible to manually enter into them. With this in mind, I figured I could write a web service to create the entries at the totaling accounts. However, when attempting to create the entry, it errors with : Date must have a value in G/L Budget Entry: Entry No.=2. It cannot be zero or empty.
I'm using the following code to create the referenced "entry":
Has anybody run into this problem before?
I'm using the following code to create the referenced "entry":
DateTime date = Convert.ToDateTime(i + "/15/15"); BudgetEntries.BudgetEntries entry = new BudgetEntries.BudgetEntries() { G_L_Account_No = split[1], AmountSpecified = true, Amount = Convert.ToDecimal(split[5 + i]), Global_Dimension_1_Code = split[2], Global_Dimension_2_Code = split[3], Budget_Dimension_3_Code = split[4], Budget_Dimension_4_Code = split[5], DateSpecified = true, Date = date, Budget_Name = split[0], Entry_No = entryno, Entry_NoSpecified = true }; Client.Create(ref entry);The "split" array is a line of tab-delimited text that the program loops through to read the data. The variable "i" is incremented in a while loop to get each month's Amount. I have confirmed that the "entry" variable has a date, as
Console.WriteLine(entry.Date);produces 1/15/2015 12:00:00 AM.
Has anybody run into this problem before?
0
Comments
-
Hi,
Have you tried to use Date instead of DateTime?
i.e. DateTime dateOnly = date1.Date;
and then just pass dateOnly ?
regards, wisaAustrian NAV/BC Dev0
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