5 Replies Latest reply on Aug 29, 2012 10:40 PM by comment

    Record-Level Access Script

    artsmerch

      So I'm trying to set up a security access so the sales department can only see pieces available for sale only. I have a column that designates sold with S and A for available. I need to script the security so that it finds and shows only the A pieces and hides or doesn't show the S pieces.

      I'm thinking an if statement but I'm not sure. I've written the following but this doesn't work. Help is much appreciated. Thank you!

       

      Go to Layout ["Gallery Price List"]

      Go to Record/Request/Page [First]

      Loop

      If [Art Database::Status = "A"]

      Show Record

      Else

      Do Not Show

      End If

      Go to Record/Request/Page [Exit After Last, Next]

      End Loop

        • 1. Re: Record-Level Access Script
          comment

          Try setting this up in the privilege set used by the sales people. Once you have that, any find will automatically omit records to which the user has no access. And even in the worse case scenario, those records will only display <no access> labels.

          • 2. Re: Record-Level Access Script
            artsmerch

            I'd like to put the script in the custom record privilege set which would only allow them to see the records specified.  I'm just not sure how the write the script. Any advice on how it should look?

            • 3. Re: Record-Level Access Script
              comment

              You cannot have a script in the privilege set - nor is one necessary. All you need to do is allow access to records only when =

               

              Art Database::Status = "A"

              • 4. Re: Record-Level Access Script
                Malcolm

                You cannot have a script in the privilege set - nor is one necessary. All you need to do is allow access to records only when =

                 

                Art Database::Status = "A"

                 

                May I suggest that you use numbers instead of text values when there are only two options.  You can use zero and one. Numbers are more compact and work faster. You can use the boolean formatting to have the ones display as "Available" and the zeroes display as "Sold". In evaluations you don't need to test against a string, you simply look at the field value. So, your record access test becomes

                 

                Art Database::Status

                 

                malcolm

                • 5. Re: Record-Level Access Script
                  comment

                  Actually, I would do away with status altogether and look at  a DateSold field or something similar that records a sale. However, as OP seems to be struggling with the very concept of a privilege set, I wouldn't bring it up just now.