How to Make Visible Command Button to some user.
1) I have created a a new role. If that role exist in that user id. then only the Command Button should get visible.
2) i have created the 2 command button as "DONE" and "EDIT"
3) i have written code as follows:
Form - OnOpenForm Trigger
user.GET(USERID);
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
IF memberof.FINDFIRST THEN
BEGIN
CurrForm.Done.Visible:= FALSE;
CurrForm.Edit.Visible:= FALSE;
END;
But the above code is not working
can somebody help me out.
Thanks & Regards,
Stivan D'souza
0
Comments
CurrForm.Done.Visible:= TRUE;
CurrForm.Edit.Visible:= TRUE;
If role found?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Give this one a look : http://www.mibuso.com/forum/viewtopic.php?t=38353
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Microsoft Dynamics NAV Classic
You have specified an unknown variable.
Done
Define the variable under 'Global C/AL symbols'.
OK
Stivan D'souza
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Stivan D'souza
I mean Name property for command button..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
But if role is not specified then also its visible.
Stivan D'souza
Its Done.
user.GET(USERID);
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
IF memberof.FINDFIRST THEN
BEGIN
CurrForm.Done.VISIBLE:= TRUE;
END ELSE
CurrForm.Done.VISIBLE:= FALSE;
user.GET(USERID);
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
IF memberof.FINDFIRST THEN
BEGIN
CurrForm.Edit.VISIBLE:= TRUE;
END ELSE
CurrForm.Edit.VISIBLE:= FALSE;
Stivan D'souza
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
=D>
Stivan D'souza
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
But I once created a function in a codeunit that is "hasrole"
The same code applies, but a parameter with the rolename and a boolean return. Bam you can use it anywhere
|To-Increase|
or this :P
Just a happy frood who knows where his towel is