Dear folks, on OnOpenform from a form I've the instruction:
CurrForm.field.VISIBLE(USERID<>'USER');
It's to prevent some usersview a given field, it runs well. I want put more than an user but I don't know how. How should be the code, please?. Also, in this case, how should be not VISIBLE instruction?
Thanks in advance.
0
Comments
CurrForm.field.VISIBLE:=FALSE;
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Thanks for help.
I think is better if you use CASE instruction
Case USERID of
'USER1': CurrForm.field.VISIBLE:=FALSE;
'USER2': CurrForm.field.VISIBLE:=FALSE;
'USER3': CurrForm.field.VISIBLE:=FALSE;
'USER4': CurrForm.field.VISIBLE:=FALSE;
else
CurrForm.field.VISIBLE:=TRUE;
end;
Regards
Best regards.
How about a separate form with standard NAV security? Some people have access to one form, others have access to the other form.
Not as good, but a flag in user setup would also do the trick. If the field allowing permission for that field is checked for the user, show the field, otherwise hide it.
The solution you have written, although it does the job, is the worst way to do it.
I agree 100%.
I have a client that has code like this all through their database, written by their partner. In the end they went out and bought the Solution developer and Application Builder, because that was cheaper in the long run that what it cost their partner to keep adding users.
RIS Plus, LLC
One additional comment. If your code is on the OnOpen trigger of a list form then what will happen if the use Right-clicks the column header and selects "Show Clumn"?
There are solutions but I think the best approach is to use different forms with permissions.
Or you can add a new boolean field in User Setup (T91) Table.
And all the code is reduced to 2 lines
If TuserSetup.get(USERID) then;
currform.control.visible:=TUserSetup."New field";
Regards
Exactly
:thumbsup:
RIS Plus, LLC
viewtopic.php?f=23&t=33597
ERP Consultant (not just Navision) & Navision challenger
RIS Plus, LLC
http://www.mibuso.com/forum/viewtopic.php?t=38353.
I think this way is the best version of all : No need to maintain 2 forms and no need to reprogram to add/remove a user.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!