Error consuming Codeunit

sbilly
Member Posts: 231
Hi all;
I am exposing a codeunit with a function that i want to use inside my published page. Till here everything is allright,
but when I try to consume this codeunit I have this error : Parameter devis in method LancerDevis in service DevisVC is null!
I am exposing a codeunit with a function that i want to use inside my published page. Till here everything is allright,
but when I try to consume this codeunit I have this error : Parameter devis in method LancerDevis in service DevisVC is null!
0
Comments
-
Sounds like you are passing a null parameter. If you can post the code you are using to call the webservice, that would be helpful.0
-
MattKeyes wrote:Sounds like you are passing a null parameter. If you can post the code you are using to call the webservice, that would be helpful.
public void Button1_Click(object sender, EventArgs e) { // Creation de l'en-tête Devis var Nouv_Dev = new DevisVC(); Dev_srv.Create(ref Nouv_Dev); Nouv_Dev.Délai_de_validité = int.Parse(TB_DVal.Text); TB_No.Text = Nouv_Dev.No; TB_DatDev.Text = Nouv_Dev.Document_Date.ToShortDateString(); //TB_Statut.Text = Nouv_Dev.Status.ToString(); CB_VC.Checked = Nouv_Dev.Vente_à_Credit; // Creation ligne Devis Nouv_Dev.SalesLines = new Sales_Quote_Line[6]; for (int i = 0; i < 6; i++) { Nouv_Dev.SalesLines[i] = new Sales_Quote_Line(); } } private void Button2_Click(object sender, EventArgs e) { Dev_srv.UseDefaultCredentials = true; Dev_srv.LancerDevis(Nouv_Dev.Key); Dev_srv.Update(ref Nouv_Dev); }
After the creation of the quote with Button1, I want to release it by clicking Button20 -
You might try this:
private void Button2_Click(object sender, EventArgs e) { if(Nouv_Dev != null && Nouv_Dev.Key != null) { Dev_srv.UseDefaultCredentials = true; Dev_srv.LancerDevis(Nouv_Dev.Key); Dev_srv.Update(ref Nouv_Dev); } }
From my understanding, it is likely you are doing this from an ASP.NET application, and all of the objects you are relying on may not be in a consistent state.0 -
I think you have two variables with name Nouv_Dev. One defined in the Button1_Click into which you are reading the data, and one "global" which you are using in the Button2_Click, which is not initialized...0
-
Hi all,
I resolved it .
All what i have to do is to re-read the quote.protected void Button2_Click(object sender, EventArgs e) { Nouv_Dev = Dev_srv.Read(TB_No.Text); Dev_srv.LancerDevis(Nouv_Dev.Key); }
thanks for all.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