C# app which works with Codeunit Web service

casio11
Member Posts: 13
Hi,
I have C# app which have to use function from Codeunit which have to modify some fields.
Here is a code from app..

Here is function from Codeunit..

I test app, and it works when, return some value in label or textbox, but when should to modify fields in nav doesnt work.
Help
I have C# app which have to use function from Codeunit which have to modify some fields.
Here is a code from app..

Here is function from Codeunit..

I test app, and it works when, return some value in label or textbox, but when should to modify fields in nav doesnt work.
Help

0
Answers
-
Can you be a little more specific than 'it doesn't work'?
Opened the NAV debugger to see what happens?0 -
-
Had this error last week. Don't ask me why but don't use UseDefaultCredentials. Using System.net.NetworkCredential got rid of the error for me.Austrian NAV/BC Dev0
-
Wisa123,
Can you show me how you resolve this problem ?
0 -
using System.Net;
NetworkCredential cr = new NetworkCredential("userName", "password", "domain");
wst.Credential = cr;
Use those 2 lines instead of the UseDefaultCredential. Didn't try it now but it should work.Austrian NAV/BC Dev0 -
Wisa123,
Dont work again. When i add return parametar in my Codeunit function,
GetLocation(LotNo,loc) return Test:text, Test:= LotNo+Loc, and edit my C# app label.text=GetLocation(Lot,Lok), program works, app return value, but didnt want to modify field in NAV.
Only want to return value0 -
Hi,
Rather than having the function return a Text, modify it so the functions returns nothing, but has a seperate VAR parameter of TEXT, then in your c# code, you pass a seperate string as a ref.
So the c# code would look like, i have boxed the 2 changes, just make sure you change the NAV side function and update your web reference
Try that.
Regards
Roland0
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