C# Web Service Error

booneboone Member Posts: 23
edited 2015-02-11 in NAV Three Tier
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":
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
produces 1/15/2015 12:00:00 AM.

Has anybody run into this problem before?


  • Options
    Wisa123Wisa123 Member Posts: 308

    Have you tried to use Date instead of DateTime?
    i.e. DateTime dateOnly = date1.Date;
    and then just pass dateOnly ?

    regards, wisa
    Austrian NAV/BC Dev
Sign In or Register to comment.