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
0
Answers
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/
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
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
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
KMK
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Ishwar Sharma
My Blogs: Dynamics Community Blog | Blogspot
Connect: Google + | Twitter
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);
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
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
usersetup.GET(USERID);
IF usersetup."Hide Unit Cost" THEN
UnitCostHidden := TRUE;
Hi Kishorm,
Thank you for pointing this out - it is something I forgot to point out.
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.
Ron
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
thanks you
it is working