-If you mean this : if a user X has a certain record A in the form, than user Y cannot see this record? => This is not possible.
-If you mean this : if user X created sales order A, then only he or a superuser can see it? => create a new field in T36 ("Created By User"), fill it up with the userid of the user.
OnOpenForm-trigger:
recMemberOf.RESET;
recMemberOf.SETCURRENTKEY("User ID","Role ID",Company);
recMemberOf.SETRANGE("User ID",USERID);
recMemberOf.SETRANGE("Role ID",USERID);
recMemberOf.SETFILTER(Company,"%1|%2",COMPANYNAME,'');
IF NOT recMemberOf.FIND('-') THEN BEGIN
// the user is NOT a superuser in current company, so he can only see his own orders
FILTERGROUP(6);
SETRANGE("Created By User",USERID);
FILTERGROUP(0);
END;
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Comments
To avoid opening the form:
OnOpenForm-trigger:
IF USERID IN THEN
currform.close;
OR also
IF USERID IN THEN
ERROR('YOU CANNOT OPEN THIS FORM'); // but of course with a text-constant!
To avoid modifying :
OnOpenForm-trigger:
CurrForm.EDITABLE(NOT (USERID IN ));
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
In table UserSetup, create Boolean Fields corresponding to permissions you want to manage.
So , in the code from kriki, simply replace condition with
IF UserSetup.GET(USERID) AND (UserSetup.Condition) THEN ...
Hope can help ...
I'm sorry, my question is not precise enough
I start again
The goal is to forbidden users to access to the record of sales order Form, while an another user already accessing to the same order (record).
I thank you
regards
-If you mean this : if user X created sales order A, then only he or a superuser can see it? => create a new field in T36 ("Created By User"), fill it up with the userid of the user.
OnOpenForm-trigger:
recMemberOf.RESET;
recMemberOf.SETCURRENTKEY("User ID","Role ID",Company);
recMemberOf.SETRANGE("User ID",USERID);
recMemberOf.SETRANGE("Role ID",USERID);
recMemberOf.SETFILTER(Company,"%1|%2",COMPANYNAME,'');
IF NOT recMemberOf.FIND('-') THEN BEGIN
// the user is NOT a superuser in current company, so he can only see his own orders
FILTERGROUP(6);
SETRANGE("Created By User",USERID);
FILTERGROUP(0);
END;
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!