How-to: Set View Mode on Pages as Default

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. Yes

Issue

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:

Solution

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!

Workaround

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'.WshShell
In OnOpenPage Trigger:
...
IF ISCLEAR(WshShell) THEN
  CREATE(WshShell,FALSE,TRUE);
WshShell.SendKeys('^+V');//Ctrl+Shift+V


here 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! Cake

Future

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.Geeked

Anonymous
Related
Recommended