Setting a filter for sales raps on contacts

stefanostefano Member Posts: 3
edited 2004-01-13 in Navision Attain
Hello all,
I'm a Navision Attain 3.60 User and I'm developing few things on my own, but I need some help. I'm using the native Navision DB.

This is what I want to do:
I have sales raps connecting to my system but they shouldn't be able to see every contact ( :!: issue #1 - i need to set a filter they cannot erase). Using the field "Salesperson Code" is too resctrictive because a big customer might need to be handled by more than one sales person ( :!: issue #2, some contact might be shared).

Here is what I've done:
I added a field ("UserID) to the Salesperson/Purchaser table in order to extract the salesperson code which belongs to the user logged in.
Then I created a simple table to make a many to many relation between Salesperson table and contact table.
Now I need to create a filter in order to display to the user only the contact he is allowed to see, which are listed in the table mentioned above.

I hope someone has already had this problem (or a similar one). Please help me and forgive me if what I've done is tremondously wrong :oops: , but I'm a "Power User" not a Programmer.
Thank you all

Comments

  • Timo_LässerTimo_Lässer Member Posts: 481
    If you put your filters in a filtergroup <> 0, the user cannot see (or delete) this filter.
    Contact.FILTERGROUP(2);
    Contact.SETRANGE(<Field>,<Value>);
    Contact.FILTERGROUP(0);
    

    Due to the fact that you have a many to many relation, the best way to filter is to work with Marks.
    [...]
    ContactSalesPerson.SETRANGE("Sales Person Code",SalesPerson.Code);
    IF ContactSalesPerson.FIND('-') THEN
      REPEAT
        IF Contact.GET(ContactSalesPerson."Contact No.") THEN
          Contact.MARK(TRUE);
      UNTIL ContactSalesPerson.NEXT = 0;
    Contact.FILTERGROUP(2);
    Contact.MARKEDONLY(TRUE);
    Contact.FILTERGROUP(0);
    
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • stefanostefano Member Posts: 3
    Thank you for your answer.
    I've used the filtergroup function and it works, but partially. In fact you cannot see the filter but if you click on the showall button (Shift+CTRL+F7) you can remove it.

    I'm still working on the second issue and I'm afraid I think I will need some more help...

    Thanks again anyway
  • DenSterDenSter Member Posts: 8,307
    I don't think MarkedOnly is affected by filtergroups, so that won't work. It's really not a field that you filter on.
Sign In or Register to comment.