Pass Recordset in Web Service

julkifli33
Member Posts: 1,092
Hi All,
are we able to pass record in web service?
This is my code to sync data cross company in 1 tenant.
but i just thinking to do for cross tenant via web service.
i dont think we can use transferfields in web service.
any advise?
Thanks.
are we able to pass record in web service?
This is my code to sync data cross company in 1 tenant.
Company.reset; if Company.findset then repeat ToGLAccount.ChangeCompany(SyncCompany.Name); ToGLAccount.Reset; if ToGLAccount.get(ParGLAccountNo) then begin ToGLAccount.TRANSFERFIELDS(FromGLAccount, FALSE); ToGLAccount.MODIFY(TRUE); end else begin ToGLAccount.TRANSFERFIELDS(FromGLAccount); ToGLAccount.INSERT(TRUE); end; Until Company.Next = 0;
but i just thinking to do for cross tenant via web service.
i dont think we can use transferfields in web service.
any advise?
Thanks.
0
Answers
-
Hi,
You can create a xmlport for table GLAccount with 'AutoUpdate' - true
create a codeunit with function which will have parameter the xmlport you created.
Now expose that codeunit through webservice.
Now you can call webservice URL like belowCompany.reset; if Company.findset then repeat //Call web service with url company name Until Company.Next = 0;
Thanks0 -
Hi Aniissh,
lets say now i have 15 fields to be sync.
and then in the future i add 2 more fields.
so it means I need to add 2 more parameter to this codeunit?0 -
I just thinking to use API (Odata) for different tenant
so instead of pass field by field.. could it be by 1 recordset?
0 -
You still need to Serialize and Deserialize your data to/from some format. There is no way to pass the actual Recordset. Also the ToGLAccount.MODIFY(TRUE) and INSERT(TRUE) triggering does not trigger in the other company and can have nasty side-effects.0
-
Hi @Duikmeester
thanks for your comment.
so it means my understanding is correct right?
--> " lets say now i have 15 fields to be sync.
and then in the future i add 2 more fields.
so it means I need to add 2 more parameter to this codeunit?"0 -
You can never have a Record as a part of Parameter in Web Services.
So if you need to have a record set have an xmlport and receive it as a Bigtext(Can explore TextBuilder Data type if it's Business Central).
P.S - Normally if its just handful of fields we make it as a direct parameter but if bunch of fields then XmlPort would be the best option as adding 2 more fields as yu saying will be an easier job.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/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