hi,
I need to enable some fields in requisition work sheet only for several users.
I wrote following code in the OnOpenform trigger,but it is not working perfectly
IF USERID = 'CHANAKA' THEN
CurrForm.Confirmed.EDITABLE := TRUE
ELSE
CurrForm.Confirmed.EDITABLE := FALSE;
0
Comments
If you want to make something accessible/editable for some users, make it setup based instead.
Use the user setup table to configure the user access for a specific form/table (using boolean), and write a small function which checks the Login ID with that of your setup, and accordingly does as required.
Deep
India
Check also this : http://www.mibuso.com/forum/viewtopic.php?t=10695
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Simple rule of thumb: If you've hard-coded something then you're probably doing something wrong.
My Blog - nav.education
I agree with u.I'll include another field in the User Setup table and try to restrict through coding.
Thanks
Erandi
Once a boolean has been created in the setup table for REQ work sheet editable.
then you'll just do a get usersetup.get(userID);
before your code
usersetup.get(userID);
IF MYBOOLEAN THEN
CurrForm.Confirmed.EDITABLE := TRUE
ELSE
CurrForm.Confirmed.EDITABLE := FALSE;
http://www.BiloBeauty.com
http://www.autismspeaks.org
With my system, you just implement the codeunit for the test. And in each form where you need a test, you just add the code to test. For the rest you can just create a new role (without permissions under it) and add/remove users to it whenever you want.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Ultimate... =D>
Deep
India
If this is exactly as stated that it certain number of fields for a certain number of users, then just create a new form. On the existing form remove or make non editable the fields that those users will not have access to. The users that need access to more fields will have access to the new form. This is then handled by standard Navision security. And if the client wants to add or hide more fields its simple.
Don't write code unless its needed.
It's becoming a lost art form though :thumbsdown:
RIS Plus, LLC
MVP - Business Apps
Good point. We have started controlling access through menus it seems to be a decent solution. Now whenever I set up a new user, besides copying a similar user's roles, I also copy their Menu Restriction as well.
However, I think that for the scenario from this thread, there is no way through *standard* Nav permissions to control which of the two forms a user has access to, assuming they get execute permission to all forms, since both forms have the same source table.
Thank you
http://mibuso.com/blogs/massivedynamicsnav/2009/07/
And if the customer wants a new field and you put a new programmer on it (no need to use an expert to do this), he probably will only find 1 form.
My solution is between too-much-code and too-much-forms.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
There is something seriously wrong when a Navision customer needs to pay for a developer to add a new field to a form. I would always be training the customer to do that them selves.
I would agree training is always the best solution.
But the customer would never remember how to do them.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
My Blog - nav.education
For the Requisition I guess it doesn't matter since their card/list relationship is a little weird.
In order for a Customer to be able to add a new field to a form, the field must be a field from the table, not based a computed value, which is what many Customers require.
In order to have a computed field, that field could be a flowfield, which you would need to explain how to create a flowfield or some variable. How much is that Customer paying?
ERP Consultant (not just Navision) & Navision challenger
2) I prefer they don't do that. I have very bad experience wth it. Even if explained well what they need to do (documentation,send us the objects,...) they don't do it (forget or don't care). And if they mess up something, the blame us and we should fix it without that they pay us.
So best is they don't go in design.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
my objective is allways to make the customer as self sufficient as possible, and train them to do it properly. Writing code should allways be the last resort.
RIS Plus, LLC
MVP - Business Apps
But Daniel, you know that both you and I have been in that sales meeting where the sales person said "Sure for $800 bucks each you can buy the designers so you can customize screens and make all the reports you need youself so that you wont be dependant on us for everything.
After that its total BS to go back and tell the client, "um sorry I know we told you to buy these, but we don't want you using them".
1.) user rights management becomes complex and elaborate to handle (as mentioned above) when one introduces execute permissions on objects
2.) Further form design efforts on req. worksheets will duplicate, because there are now two forms to handle
3.) The method is hardly extendable (consider a third group of users, which should have other columns dis-/enabled)
But even a programmatic solution (via flag in user setup table) is not the best solution, I think.
As this kind of problem is not too rare, may be a general solution is worth while thinking about it. How to make arbitrary fields in arbitrary forms visible/editable for certain user roles? This may eventually give rise to some extension of standard functionality...
RIS Plus, LLC
MVP - Business Apps
My experience though is that in the early stages the customer makes a few expensive mistakes, but over the years save a lot by having the skill in house. Its important to remember that if you have a car worth $10,000 your don't pay $11,000 a year for insurance. You buy a new car when you have a crash.
My reason for interjecting in this thread, is that the client seems to have a very simple requirement and every response was to write code. I am not saying that code is not the correct solution. I am saying investigate all options before just hitting Shift+F12.
As consultants its our job to understand the issue, know the future direction the customer needs to head, and based on FACTS give them sound advise.
Writing code should always be the last option after all other options are exhausted.