Permissions for Vendor Form

IrishGiriIrishGiri Member Posts: 61
I want to allow only one user full read/write permission to the Vendor Card. All other users can only have read permissions to the info. conatined in the vendor card. What is the most elegant solution to this problem?

Permissions in Navision is something I'm not too clear on...

Thanx in advance!

Comments

  • ArhontisArhontis Member Posts: 667
    Hello,

    Standard Nav has two roles (P&P-VENDOR and P&P-VENDOR, EDIT) that you can assign to your users and will do the job.

    * P&P-VENDOR is for reading
    * P&P-VENDOR, EDIT is for read/write

    In case you don't have those roles, then restore a Cronus and study how are those roles where made regarding the Vendor table.
  • IrishGiriIrishGiri Member Posts: 61
    I used the following code in the OnModify Trigger of the Vendor Table:


    OnModify()
    IF (USERID <> 'GERRY') AND (USERID <> 'ADMIN') THEN
    ERROR('You do not have permission to edit this form');

    Works ok now.

    Thanx!
  • ArhontisArhontis Member Posts: 667
    Ok... hardcoded...

    In that case you can use the following instead:
    Form - OnOpenForm()
    ActivateFields;
    CurrForm.EDITABLE(CurrForm.EDITABLE((USERID='GERRY') OR (USERID='ADMIN')););
    
    But I strongly recommend not to hardcode like that...
    You should avoid modifications when you can use standard functionality...
  • girish.joshigirish.joshi Member Posts: 407
    You *really* shouldn't do it this way IrishGiri (nice name, by the way)

    Down the road, coding permissions can be a huge pain to maintain. If at all possible (and its so easy to do in this case) standard Navision permissions should be used. Look at Arhontis' first suggestion.

    Furthermore, if you are going code your way out, the standard way of doing this is modifiying the UserSetup table. Create a boolean field that indicated the users have editing rights, and then in the vendor onmodify trigger, check that field to determine what to do next.

    Arhontis coding solution is also not recommended because it puts more code on the form. That can be a pain to find, and is becoming less portable with 5.0.

    Short answer: don't do it!
Sign In or Register to comment.