Hi everyone! I need to set the option delete allowed according to the USERID.
My problem is to do this using the code because i don't want to block ALL the users, just a specific understand? My struggle is how to get this page object property in the code..
I want to do something like
IF USERID='john' THEN
PAGE.deleteallowed=FALSE;
I know that PAGE.deleteallowed don't exist but I need something to make this work.
*This post is locked for comments
Thanks a lot it worked!! :)
Yes that't my point it's no a simple assignment so i'm a little confused with that answer.. I understand the point but how to validate with the deleteallow itseld?
No NAV with me at the moment to check but DeleteAllow property (if I remember correctly) cannot be assigned to a Boolean variable, but it’s only a yes/no option. I suggest to use roles instead (much better and flexible).
So I've created a new variable in table 91 (User setup) as you said and I've add a user and check this field. Now in my page in the property DeleteAllowed I juut have the no/yes option.. I've already add the code in the OpenPage event and get the user logged in.
I assign DeleteAllowed=No in my page is that? I'm confused sorry.
Sorry for last answer, I should test it first, I messed it
Add a field in User setup, XX_DeleteAllowed
Under Table Trigger:
OnDelete()
UserSetup.GET(uppercase(USERID));
if not UserSetup.XX_DeleteAllowed then
error('not allowed table');
Test:
or Under Page Trigger:
OnDeleteRecord() : Boolean
UserSetup.GET(uppercase(USERID));
if not UserSetup.XX_DeleteAllowed then
error('not allowed page');
Test:
You cannot do that, this is a property that cannot be modified from C/AL. You can use roles for avoiding the delete option.
Sohail Ahmed
2
mmv
2
Amol Salvi
2