Limiting User access to a SKU location?

rstolsrstols Member Posts: 28
I am trying to limit users to only be able to modify SKU's that pertain to them.
I tried the following to make it work:

1. Adding a field on the User Setup table and assign a default location to each user.
2. Adding the following code on the OnModify trigger of the Stockkeping Unit table:
UserSetup.GET(USERID);
UserSetup.TESTFIELD("UserLocation", SkuLocation."Location");

I am not a Nav programmer but I am trying to compare the default user location to the location on the SKU - if it is the same, then allow changes to the record.

Thanks in advance for any suggestions how to make this work?

Comments

  • SavatageSavatage Member Posts: 7,142
    rstols wrote:
    I am trying to limit users to only be able to modify SKU's that pertain to them.
    I tried the following to make it work:

    1. Adding a field on the User Setup table and assign a default location to each user.
    2. Adding the following code on the OnModify trigger of the Stockkeping Unit table:
    UserSetup.GET(USERID);
    UserSetup.TESTFIELD("UserLocation", SkuLocation."Location");

    I am not a Nav programmer but I am trying to compare the default user location to the location on the SKU - if it is the same, then allow changes to the record.

    Thanks in advance for any suggestions how to make this work?

    UserSetup.GET(USERID);
    TESTFIELD(Location,UserSetup."UserLocation");

    or how about
    UserSetup.GET(USERID);
    If Location <> Usersetup."UserLocation"
    Then ERROR('User %1 is not allowed to change this Particular Location',UserSetup."User ID");

    We don't use Stockkeping Unit table so if it's a specific field they are changing I would put it on the Onvalidate of the particular field. Either way give it a try.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Instead of giving error messages, why not just filter out the locations you do not want them to see?

    Check how the Responsibility Center works or search FILTERGROUP on the help file or on this forum.
  • rstolsrstols Member Posts: 28
    Thank you, it's now working fine.
Sign In or Register to comment.