how to send bunch of records in codeunit by navwebservice

Ashish_Gupta
Member Posts: 56
I made codeunit which is using record type field and use this codeunit on website by nav web services how to send bunch of filter records in codeunit.

Ashish Gupta
Navision Technical Consultant
Navision Technical Consultant
0
Comments
-
It sounds like you want to insert multiple records into a table using Nav 2009 web services. Unfortunately, you can't pass record type variables as parameters to a CodeUnit-based web service. You'll need to create a web service based on a Page to do this. Then you can do CRUD (Create, Read, Update, Delete) operations on the table by calling the appropriate functions on the web service.
Visit the documentation at http://msdn.microsoft.com/en-us/library/dd355316.aspx to see how to surface a Page-based web service.
Tim Larson0 -
Send the records in a xmldocument to the codeunit with the datatype bigtext. In C# you can easily transform the dt into xml.
You can also use arrays parameters in the codeunit.0 -
Use an XMLPort.
This allows you to describe how the scructure needs te be uploaded to the server.0 -
Your best bet is to use Pages.
You can use Arrays, but this is really not a desired solution for passing records around. It is much more overhead and you will have problems if you try to use multi-dimensional arrays over the web services. Also you constantly have to code around the fact that NAV indexes at '1' and in nearly all other languages indexing is at '0'. Also in C# sharp you need to declare your Array with the correct number of elements, unlike VB.net where you can re-dimension your array... so if using an array in C# you need to know how big the array is that you are receiving back to declare it and get the contents.
XMLDocument into BigText would work, but again you have the overhead handling your BigText on the NAV side, which you don't have with Pages. Transposing your dt->XML (and vice versa) is really easy in .NET however it is just as easy to create a generic function which takes your returned Page read Object and converts it to a data table or a data set (data table is quicker than data set).
So use Pages from your project and then translate your returned page object to a data set or data table using a generic C# class.0 -
Hi,
I'm using navision customer webservice and calling the Create, Read, Update, Delete methods in a C# project (WCF Technology), I have a little problem calling the update and the delete methods :oops:
How can I update the appropriate customer record? What's the right instruction to use to update and to delete a customer record?
Thanks for your Help. :thumbsup:Regards
Hanen TALBI0 -
This is quite simple.
Firstly Read the customer you want to update.
Such as
Customer myCustomer = ws.Read(pCustomerNo);
Then set the fields you want to update such as
myCustomer.Name = 'Joe Bloggs'
then call
ws.Update(ref myCustomer);
Good Luck!0 -
Thank you for your help but one more question the "pCustomerNo" is a key that I will choose how will I tell the WS that my key in this case is the customer No knowing That I have more than one key in my table :oops:Regards
Hanen TALBI0 -
Read will always be used when you are reading in one record. Similar to a GET in NAV. If you want to read in multiple records then you must use ReadMultiple passing in an array of filter values. You will then be returned a collection of records to work with.
Hope that helps
Adrian0 -
Thank you so much for your help, I'm using that
NAVCustomerServices.Customer NavClient = new HanenWcfServiceLibrary.NAVCustomerServices.Customer(); //Creating Filter List<Customer_Filter> FilterArray = new List<Customer_Filter>(); Customer_Filter FilterCompteFact = new Customer_Filter(); FilterCompteFact.Field = Customer_Fields.No_Customer_Extranet; FilterCompteFact.Criteria = Customer_Extranet.RefCustomerNo; FilterArray.Add(FilterCompteFact); //Fields to Update NavClient.Address = Customer_Extranet.Rue; NavClient.City = Customer_Extranet.Ville; NavClient.E_Mail = Customer_Extranet.email; //..................................... NavCustomerService.Update(ref NavClient);
Regards
Hanen TALBI0 -
But that code above can not be working properly right?
You have applied some filters and called the update but you do not have the actual Customer record filters applied...
Are you not getting problems with this code...?0 -
No I'm getting the actual customer by parameter, it's passed with the method.Regards
Hanen TALBI0 -
So you are doing a Read on the Customer No. and then doing an update. So why do you have the code in the middle building the FilterArray as from what I can see you are not using this...0
-
I'm Updating the Navision record customer related to the customer record coming from the extranet by parameter, so I have to read the customer form nav filtring on the Nav.No_Customer_Extranet= Customer_Extranet.RefCustomerNoRegards
Hanen TALBI0 -
Ok... so you are using code that is different to what you actually posted?
Because I can't see that the code you posted will work as there is no Read or ReadMultiple.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