Thursday, December 17, 2015

Dynamically hide/display fields in Report request page - NAV 2013 OR NEWER Part II

2.. Process to Dynamically hide/display fields in Report request page
As Discussed in earlier Post. We can achieve request page Fields using / Setting Visibility of respective fields  . So in this post i would use a  INPUT BOX.
Below is example from Saurav Dhyani sir, i used it in my case.
How we used to use it in NAV 2009 Classic or Before -

Below is the code that we used to write for using InputBox to accepts inputs from User. In this case i will store the results in CustomerNo Variable as shown.


Here is what we have when i tried to run this codeunit.



Let's Move this codeunit to NAV 2013 R2 and try to Run the Same. 

It did compiled as shown below -



But Let's see what happens when i tried to run the same. Oh this ends up with an error message saying - "The Input Method is Obsolete".

How we can use it in NAV 2013 and Later?

DOTNET have the Same Funtion with a minor Change which can be used as Input Box.

I will Change the Paramter as Below -

--------------------OLD----------------
Name   = Window
DataType  = Dialog
SubType   = ''
--------------------OLD----------------

--------------------NEW-----------------
Name    = Window
DataType = DOTNET
SubType  = Microsoft.VisualBasic.Interaction.'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
------------------NEW--------------------

* Make Sure You change the Property RunOnClient = TRUE for the Variable Window, 


coming  to our example we need a boolean variable to to set the fields  Visibility , So i Prompted window to select true/ false . Like Below...




Then Set that Bool value , BUT the thing is that we should add code in onOpen page ()Trigger


One more thing is that we should/can only write above code  in ONINIT() or OnopenPAge 

because these are only area that i hav seen effect after that page is already instantiated so there would be no effect.



The Flaw in this process is that once you got request page there is no use of boolean variable as if you change it to false i mean uncheck BOX  there would be no use ...

So go for 1st Process , if you need  you can use 2 nd process

Thank you ...........

No comments:

Post a Comment