How hide a field for a selected user
kmkaot
Member Posts: 261
Dear Friends
Please suggest me..
I want hide unit cost values for some users. will suggest me what code I should write
usersetup.GET(USERID);
if usersetup.costhide then
begin
// I want help her
unit cost visible false
//======
end;
Please help
warm regards
KMK
Please suggest me..
I want hide unit cost values for some users. will suggest me what code I should write
usersetup.GET(USERID);
if usersetup.costhide then
begin
// I want help her
unit cost visible false
//======
end;
Please help
warm regards
KMK
0
Answers
-
Hey,
Check this out
https://community.dynamics.com/nav/f/34/t/120881
http://kauffmann.nl/index.php/2016/01/14/dynamically-hide-and-show-controls-on-card-page/Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
Hi kmkaot,
You can check this solution as below
https://dynamicsuser.net/nav/b/peik/posts/how-to-hide-cost-prices-from-some-users-in-dynamics-nav
0 -
I think this will not work.
I wrote code NAV 2009 like this
====================
if UserId = 'X' then
"Unit Cost".VISIBLE :false;
====================
I want to know same kind of code
Please advice..
warm Regards
KMK0 -
are you using classic client or rtc?0
-
You must take help from a developer to achieve your desired output.
0 -
I am looking for a developer for my Dubai operations.0
-
Kamkpt,
This Code will never work
"Unit Cost".VISIBLE :false;
If its classic client then you need to write code on the form like this.
CurrForm."Unit Cost".VISIBLE(FALSE);
Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
In RTC in 2009 and in 2013 and later, the VISIBLE property can be controlled by a variable:
1. Open the page in the Development Environment
2. Create a global variable, type Boolean, e.g. UnitCostHidden
3. Select the "Unit Cost" field and view the Properties
4. In the "Visible" property, insert the name of your new variable preceded by NOT, e.g. NOT UnitCostHidden
Since the default of a Boolean variable is FALSE, the default value will be TRUE (i.e. NOT (False)), so the default of the field will be visible.
Then, in your code:
====================
if UserId = 'X' then
UnitCostHidden := TRUE;
====================
Now, when the field is displayed, the VISIBLE property will be (NOT (True)) = FALSE, so the field will be hidden.
Your code to set the UnitCostHidden should be in the OnAfterGetCurrRecord OnOpenPage trigger.
Good luck!
Ron
Ron0 -
Regarding the solution provided by @rsaritzky - you'll also need to make sure that you set the IncludeInDataset property to Yes on your Boolean variable (UnitCostHidden)0
-
still showing
usersetup.GET(USERID);
IF usersetup."Hide Unit Cost" THEN
UnitCostHidden := TRUE;0 -
Regarding the solution provided by @rsaritzky - you'll also need to make sure that you set the IncludeInDataset property to Yes on your Boolean variable (UnitCostHidden)
Hi Kishorm,
Thank you for pointing this out - it is something I forgot to point out.Ron0 -
KMK,
I am sorry for giving you a little incorrect information. Being pretty sure that this should work, I tested it myself, and you are correct - it does not work.
You must put the check for the UserID's permissions in the OnOpenPage trigger, NOT the OnafterGetRecord or OnAfterGetCurrRecord trigger. If you put it there, it should work. I will try to find an MSDN reference on when this property for the field is evaluated.
RonRon0 -
OK, here's the full explanation according to MSDN:
https://msdn.microsoft.com/en-us/library/dd355373(v=nav.90).aspx
It says (among other things):
1. Using a variable for field and action controls requires that the variable be resolved by the OnInit Trigger or OnOpenPage Trigger.
2. The dynamic options are only possible for group and part controls.
SO, if you have a need to dynamically change the hidden property on a field as you move from record-to-record, you need to put that field into a group on the page, then assign the "hidden" variable to the group. I test this and it then works if you put the setting of the hidden variable in the OnAfterGetRecord or OnAfterGetCurrRecord trigger.
In your case, since the hidden property is based on the User, you can put your code in the OnOpenPage trigger and it should work for you.
Once again, I apologize for misleading you a bit. I DID try <grin>.
Ron
Ron0 -
thanks0
-
Very nice
thanks you
it is working
0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions


