Tuesday, January 19, 2016

Show /Hide Fields In Nav Pages Using C/AL

This Post is As Requested For friend  Zayed From DUG Here's Link.

As Per Zayed Requirements i.e Let's say We want To Hide the Fields That we no longer Want to use

Standard Way
Normally in Nav we have a Build Option To choose which columns to show and others to Hide. Everyone Know that But Lets see...

Lets Take Customer List Page For Our Example...

Now Right Click On header Select Choose Cloumns As Shown In Above Picture.. Then you will see another window... Like below...

you can add what ever you like and Remove Any Unwanted Columns from Here .. Thus Ends Standard Way ...

Now Lets say If You dynamically Needed to Remove/Hide the Fields you can do this by using Some Small Code and a Variable...

Let's Do it ...
Create a Global variable IsVisible of Boolean Datatype


Then Select a field which you want to change dynamically and Change Visible Property to Isvisible


then Create a Function To change the visibility Throughout the Page ... Follow / Do as instructed :)

Above is my page with only two fields . NOw i want to create a function  Click Control actions..

Create like Above and Click F9 and Write below code in CAL Editor for Action ...i.e Action Trigger


Now Save It And Compile .. Done Then

Run It Works .........