DropDown on temp data from web service

Juhl
Member Posts: 724
Hi guys
I need to make a DropDown, where lookup is data from a web services, called on lookup.
Wondering the best way to do this.
My idea is to fill a temp table in OnLookup trigger, but this will force me to open a page, to pick the value.
But i need to use DropDown, and also search (filter as you type) and change column key.
Syncing the values to real tables doesn’t work, as data is different based on a previous DropDown.
So it’s a DropDown from WS, then another DropDown from WS that’s based on the one before, and then yet another.
So the dataset can’t be saved to NAV ahead of time, as the business logic from the foreign system can’t be replicated.
Any ideas ?
Need to work on web client and BC(AL) so no .NET
I need to make a DropDown, where lookup is data from a web services, called on lookup.
Wondering the best way to do this.
My idea is to fill a temp table in OnLookup trigger, but this will force me to open a page, to pick the value.
But i need to use DropDown, and also search (filter as you type) and change column key.
Syncing the values to real tables doesn’t work, as data is different based on a previous DropDown.
So it’s a DropDown from WS, then another DropDown from WS that’s based on the one before, and then yet another.
So the dataset can’t be saved to NAV ahead of time, as the business logic from the foreign system can’t be replicated.
Any ideas ?
Need to work on web client and BC(AL) so no .NET
Follow me on my blog juhl.blog
0
Best Answers
-
If it is supposed to be a dropdown I woudn't be touching the OnLookup trigger. Instead I'd be trying to set the relation on a field to some new table acting as a buffer for the web services call result. Then have a bespoke page defined as a lookup page on this buffer table, and then in the OnOpenPage trigger call the web service and fill the table with results obtained from web services call.
The lookup page could be defined as SourceTableTemporary=Yes so any web service call result stored in there would not start a transaction.
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-035 -
In scenarions when I need to decouple the code yet need to pass parameters to called object I am doing a simple trick and passing params through filters:
In scenarion like calling PAGE.RUNMODAL(someid, somerec), or CODEUNIT.RUN(someid, somerec) where someid comes form some setup field, and still having to pass some parameters to called object I'd be coding this as in the mockup code below:T39.SETFILTER("Document No.", '*|'+MyParameter);
PAGE.RUNMODAL(someidcomingfromsetuptable, T39)
Then all objects which are supposed to be called that way would have a little code in OnOpenPage, or in OnRun, to retrieve requested parameter from the filter passed on rec, and the clear the filter (maybe leaving whatever is on left side of the | char as the "real" filter.
In case like this one where OnLookup trigger can't be really touched I'd be setting up conditional/filtered relation, where the condition or filter would include required parameter(s):
Then in OnOpenPage I'd try retrieve my parameters passed in filters.
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-035
Answers
-
If it is supposed to be a dropdown I woudn't be touching the OnLookup trigger. Instead I'd be trying to set the relation on a field to some new table acting as a buffer for the web services call result. Then have a bespoke page defined as a lookup page on this buffer table, and then in the OnOpenPage trigger call the web service and fill the table with results obtained from web services call.
The lookup page could be defined as SourceTableTemporary=Yes so any web service call result stored in there would not start a transaction.
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-035 -
Hi Slawek
Of course, I didn't think of creating a page for the buffer table. That would work.
Only downside is validation, as you cant test for tablerelation, so the user can input anything he wants. But again that could be tested against the webservice.
Thanks.
Follow me on my blog juhl.blog0 -
In scenarions when I need to decouple the code yet need to pass parameters to called object I am doing a simple trick and passing params through filters:
In scenarion like calling PAGE.RUNMODAL(someid, somerec), or CODEUNIT.RUN(someid, somerec) where someid comes form some setup field, and still having to pass some parameters to called object I'd be coding this as in the mockup code below:T39.SETFILTER("Document No.", '*|'+MyParameter);
PAGE.RUNMODAL(someidcomingfromsetuptable, T39)
Then all objects which are supposed to be called that way would have a little code in OnOpenPage, or in OnRun, to retrieve requested parameter from the filter passed on rec, and the clear the filter (maybe leaving whatever is on left side of the | char as the "real" filter.
In case like this one where OnLookup trigger can't be really touched I'd be setting up conditional/filtered relation, where the condition or filter would include required parameter(s):
Then in OnOpenPage I'd try retrieve my parameters passed in filters.
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-035
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