Wanting to prepare a nice RTC demo I recalled that freddyk had built a interesting example of how to manipulate NAV data through Excel. So yesterday I sat down searched for the relevant blog posts and ... started reading:
At first glance I saw a lot of, probably very useful, code and background info, but at this point in time too much noise for what I wanted to reach. Just getting the darn thing working. Freddy, you indeed succeeded in getting me to read it all!
Following my GUT feeling I decided to crawl through the last post - i.e. Edit In Excel R2 – Part 2 (out of 2) – the final pieces - but I could not find a simple plug-and-play how-to and was not sure if just acting on these last 3 sections was enough. That's when I decided to also crawl through the rest. Well, it surely made sense to read it and get a better understanding of it all, but still no clear plug-and-play scenario at hand, eventually returning to where I started: these last 3 sections.
All [...] is captured in the NAVEditInExcelR2.msi – which is the output from the Edit In Excel Setup project. Running this .msi on a client will check pre-requisites, install the right DLL’s, register the COM and you should be good to go.
The Server Setup program actually just needs to place the Client Setup Program in a ClientSetup folder and the .fob (NAV Objects) in the ServerSetup folder;
There are no pre-requisites, no actions no nothing – just copy the files.
After Copying the files on the Server – you need to import the .fob, run the setup code unit and you should be good to go.
Note, that this requires ComponentHelper1.03 (which you can read about here and download here) to run.
The source for the entire thing can be downloaded here and the EditInExcel Demo msi can be downloaded here.
So I did set off and based on this created my own how-to. Here we go.
When selecting Actions > Edit in Excel the following errors may occur
Of course freddyk posts are the basis to this all, however here you can find a nice video demo.
One technical incident we posted to MS some weeks ago which might be of interest to you. Initially I posted it on mibuso.com, but did not get a satisfactory reply on that. You will however find the workaround suggested by the MS engineer to me also on this post as she later copied it on this post.
Our add-on I-Fresh has a generic feature that by default opens certain forms as not editable, to avoid that users accidentally start typing and modifying any data. Simply pressing a button enables the user to bring it into edit mode. Getting I-Fresh RTC ready it became apparent that we needed to redesign this feature as it could not be transformed straight forward. Instead of keep-on-trying to get it transformed one way or another, we wanted a different approach, recalling the fact that pages can be opened in either View or Edit mode.
Likewise the Customers list place - view mode:
Likewise the Customer Card task page - edit mode:
Logically we thought that this would be our solution: make sure those pages open in view mode and by using the Action or Contextual menu the user would be able to bring it from view to edit mode:
But we could not find a standard way - a property or C/AL method - that would allows us to open, for example, the Customer Card task page in this view mode. Although we were quite sure that it could open in view mode as running it from the Object Designer does open it in view mode:
And ... the page can than be brought into edit mode through the Action menu!
After reporting our issue, within 1 day (!) we did get a proper workaround as indeed the RTC platform currently does not support this altogether.
Here it is, copied from our service request:
... we found a workaround, this I tested out using Windows Scripting Host Automation and SendKeys in the OnOpenPage Trigger to toggle the Editable Property for the Page and it worked.However this is NOT SOMETHING I CAN SAY MICROSOFT RECOMMENDS or have tested on a larger scale.Anyway, this is a sample of what I tested....Declare WshShell as Automation Variable for 'Windows Script Host Object Model'.WshShellIn OnOpenPage Trigger:...IF ISCLEAR(WshShell) THEN CREATE(WshShell,FALSE,TRUE);WshShell.SendKeys('^+V');//Ctrl+Shift+Vhere the command for the Edit:WshShell.SendKeys('^+E') //Ctrl+Shift+E
And yes, we tested it also and it's working OK. Thanx Microsoft! Thanx Ariella Benchetrit!
Nevertheless, I was not fully satisfied so, although very much pleased with their effort so far, I could not just live with the fact that it's not simply supported and so I decided to push back still. To be honest I had no high expectation, but I just wanted to give off some kind of message as I was:
... still a bit flabbergasted as running a page from the object designed (see my repro steps) the page is clearly launched in View mode (and the user can change it to Edit mode); so somehow NAV supports this.
And yes, no real solution, but a promise, for whatever it is worth:
... this is in feature requests list and could be included in next NAV 7
Note: could! Help me hope it will.