mibuso.com

Microsoft Business Solutions online community
It is currently Sun May 26, 2013 12:44 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:01 am 
Offline

Joined: Thu Mar 10, 2011 10:15 am
Posts: 212
Location: MUMBAI
Country: India (in)
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


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:07 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
Should it be
CurrForm.Done.Visible:= TRUE;
CurrForm.Edit.Visible:= TRUE;

If role found?

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:08 am 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7504
Location: Milan
Country: Italy (it)
It does not work if you use Windows logins.
Give this one a look : http://www.mibuso.com/forum/viewtopic.php?t=38353

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:09 am 
Offline

Joined: Thu Mar 10, 2011 10:15 am
Posts: 212
Location: MUMBAI
Country: India (in)
I have done the necessary Changes but its saying

---------------------------
Microsoft Dynamics NAV Classic
---------------------------
You have specified an unknown variable.

Done

Define the variable under 'Global C/AL symbols'.

---------------------------
OK
---------------------------

_________________
Thanks & Regards,
Stivan D'souza


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:14 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
Did you set name fields for buttons?

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:17 am 
Offline

Joined: Thu Mar 10, 2011 10:15 am
Posts: 212
Location: MUMBAI
Country: India (in)
Its a Command Button.

_________________
Thanks & Regards,
Stivan D'souza


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:19 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
sorry..
I mean Name property for command button..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:22 am 
Offline

Joined: Thu Mar 10, 2011 10:15 am
Posts: 212
Location: MUMBAI
Country: India (in)
Yes.
But if role is not specified then also its visible.

_________________
Thanks & Regards,
Stivan D'souza


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:31 am 
Offline

Joined: Thu Mar 10, 2011 10:15 am
Posts: 212
Location: MUMBAI
Country: India (in)
Thanks Mohana.
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;

_________________
Thanks & Regards,
Stivan D'souza


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:43 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
Why do you need 2 times?
Code: Select all
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;
  CurrForm.Edit.VISIBLE:= TRUE;
END ELSE BEGIN
  CurrForm.Done.VISIBLE:= FALSE;
  CurrForm.Edit.VISIBLE:= FALSE;
END;

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 10:57 am 
Offline

Joined: Thu Mar 10, 2011 10:15 am
Posts: 212
Location: MUMBAI
Country: India (in)
Thanks Mohana i have necessary changes as per request and it working fine.

=D>

_________________
Thanks & Regards,
Stivan D'souza


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Wed Aug 01, 2012 11:07 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
Or
Code: Select all
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
CurrForm.Done.VISIBLE:= memberof.FINDFIRST;
CurrForm.Edit.VISIBLE:= memberof.FINDFIRST;

:thumbsup:

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Thu Aug 02, 2012 12:22 pm 
Offline

Joined: Thu Oct 30, 2008 10:38 am
Posts: 987
Location: Earth
Country: Netherlands (nl)
mohana_cse06 wrote:
Or
Code: Select all
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
CurrForm.Done.VISIBLE:= memberof.FINDFIRST;
CurrForm.Edit.VISIBLE:= memberof.FINDFIRST;

:thumbsup:

I prefer only one findfirst
Code: Select all
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
CurrForm.Done.VISIBLE:= memberof.FINDFIRST;
CurrForm.Edit.VISIBLE := currform.done.visible


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

_________________
|Pressing F1 is so much faster than opening your browser|
|MCBMSS: 5.0 intro|MCTS:NAV09 839..841|JetReports© Certified Specialist|
|Dynamics Anywhere: Mobile Business Solutions|


Top
 Profile  
 
 Post subject: Re: How to Make Visible Command Button
PostPosted: Fri Aug 03, 2012 3:02 am 
Offline

Joined: Mon Oct 24, 2011 2:58 am
Posts: 142
Location: Tokyo
Country: Japan (jp)
mohana_cse06 wrote:
Code: Select all
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
CurrForm.Done.VISIBLE:= memberof.FINDFIRST;
CurrForm.Edit.VISIBLE:= memberof.FINDFIRST;

:thumbsup:


Sog wrote:
I prefer only one findfirst
Code: Select all
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
CurrForm.Done.VISIBLE:= memberof.FINDFIRST;
CurrForm.Edit.VISIBLE := currform.done.visible



or this :P
Code: Select all
memberof.RESET;
memberof.SETRANGE(memberof."User ID",USERID);
memberof.SETRANGE(memberof."Role ID",'TC UPDATION');
CurrForm.Done.VISIBLE:= NOT memberof.ISEMPTY;
CurrForm.Edit.VISIBLE := currform.done.visible

_________________
Microsoft Certified IT Professional for Microsoft Dynamics NAV

Just a happy frood who knows where his towel is


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: