Error when calling a DotNet component

MHavemann
Member Posts: 10
I need to send some invoice lines to a webervice.
I used this good post on Gunnars Blog to create a proxy.
And it works a charm - but only for two of the companies in the database. When I run it for the third company I get a: "Object reference not set to an instance of an object" error.
the code looks like this
It fails in the second to last line. I have tried to insert constants in the parameters to the call, so that the only variable is the company that is selected when I run the code - same error.
I am a bit baffled - anybody that have any ideas to what can be the problem?
PS - It is on a 2013 R2.
I used this good post on Gunnars Blog to create a proxy.
And it works a charm - but only for two of the companies in the database. When I run it for the third company I get a: "Object reference not set to an instance of an object" error.
the code looks like this
UpdateCRMwithInvoiceLine(DocType : 'Invoice,CreditNote';DocNumber : Code[20];LineNo : Integer) MembershipSetup.GET; MembershipSetup.TESTFIELD("Update Invoice CRM URL"); UpdateInvoiceService := UpdateInvoiceService.OpretOpdaterFakturalinje; UpdateInvoiceService.Url := MembershipSetup."Update Invoice CRM URL"; LineIDSpecified := LineNo <> 0; ServiceAnswer := UpdateInvoiceService.OpretOpdaterFaktura(DocNumber,LineNo,LineIDSpecified,COMPANYNAME); UpdateCRMLog(DocType,DocNumber,LineNo,ServiceAnswer,'OpretOpdaterFakturaLinje')
It fails in the second to last line. I have tried to insert constants in the parameters to the call, so that the only variable is the company that is selected when I run the code - same error.
I am a bit baffled - anybody that have any ideas to what can be the problem?
PS - It is on a 2013 R2.
0
Comments
-
Does the company name include some special characters?
Did you try replacing spaces, if existing, with "%20" expression?* Daniele Rebussi * | * Rebu NAV Diary *0 -
Yes it does. But so do the Company where it works fine. And it also works with Cronus, so spaces should not be a problem (Cronus Denmark A/S).geordie wrote:Does the company name include some special characters?
Did you try replacing spaces, if existing, with "%20" expression?0 -
http://msdn.microsoft.com/en-us/library/gg502473.aspx
See this:
To call members in a .NET Framework type from C/AL code
...
3.In your C/AL code, add the following code to call the constructor that creates a new instance of the type. If you are calling a static method, then a constructor is not required, and you can skip this step.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