9 Replies Latest reply on Mar 24, 2013 4:55 PM by MarkNZ

    How to Search by Created By

    MarkNZ

      Hi All,

       

      Can you advise...Im wanting to search a Contacts Module by Created by..

       

      Heres what I want to do: I would like to have the account user be able to view only there created records when they log onto the database & viewing the CONTACTS Module.

      I presume this would be done with a trigger? on Layout enter? if so what would the script look like to achieve this?

       

      I require the user to view "list" view as well as "Form" view

       

      You may have a better way of achieving this. so open to ideas

        • 1. Re: How to Search by Created By
          MattLeach

          It may not be the proper way but this is how i did it:

           

          Edit the user's privilege set and for Records: select Custom Priviledges.

          On the Custom Record Privileges select your Contacts table and under the View setting, select limited.

          You can then enter a calculation to the effect of CreatedBy = Get ( AccountName )

           

          This will allow them to only view records that have their Account name in the created field. I then created a login script that says

           

          If Get ( CurrentPriviledgeSet ) = Rep (as an example)

               Enter Find Mode[]

               Set Field [CreatedBy; Get ( AccountName )]    

               Perform Find[]

               Constrain Found Set[]

           

          The end result is when they login, they are shown only their records, and if by chance the come across a record that is not created by them (by clicking show all or searching for a record that is not theirs) they will not be able to see the data, it will say <<No Access>> in all fields.

          • 2. Re: How to Search by Created By
            MattLeach

            I also wanted to add, this method is assuming that your CreatedBy field is set with their account name.

            • 3. Re: How to Search by Created By
              MarkNZ

              Hi Matt,

              I will give this a go.. and yes your second comment is the way im doing it..

               

              Q. In a list view will it only show the user account records..due to Perform find & contrain?

              • 4. Re: How to Search by Created By
                MattLeach

                Yes, but if they click show all, it will show everything and will see <<No Access>> in the fields of records they didnt create.

                • 5. Re: How to Search by Created By
                  MarkNZ

                  Where do I create this ??     "You can then enter a calculation to the effect of CreatedBy = Get ( AccountName )"    sorry Im abit green..  do I need to change any further settings here?

                   

                  p1.JPG

                  • 6. Re: How to Search by Created By
                    Stephen Huston

                    You set this in the Security Settings for the permission group by selecting "Limited" under the editing records setting and entering:

                       UserName_Created = Get ( AccountName )

                     

                    This assumes that you have an auto-enter value of the Account_Name being entered into the UserName_Created field. I would point out that Creation Name and Creation Account Name are not always the same name. Use the Creation Account Name for the auto-enter value so it will have to match the logged in Account Name.

                    • 7. Re: How to Search by Created By
                      MattLeach

                      At the bottom left of your screen where it says View: Yes. Change Yes to limited and add the calc there.

                      • 8. Re: How to Search by Created By

                        Most folks auto-enter Account Name to easily know who has created a record but Account Name is just as vulnerable to breaking as using a person's real name because sometimes they change the account name.  If this happens, and you search for a Users records by their current Account Name, you may not find all records.  This is especially true if you use CreatedBy for relationship.

                         

                        True that changing Account Name should not happen but it does.  The safest is store Account Name in Staff table (user record) and upon opening, find the account name and set global field or global variable to the unique StaffID and use the ID for auto-enter.  If Separation ( and using global variable ) then remember that global variables are file-specific so it needs to be set in the Data table for auto-enter.

                        1 of 1 people found this helpful
                        • 9. Re: How to Search by Created By
                          MarkNZ

                          Hi LaRetta,

                          You make a very good point & one that Im now rethinking my options. so thanks

                          MarkNZ