4 Replies Latest reply on Jun 13, 2017 7:37 AM by kht

    User properties


      I have a table, Users. I have an other table, Invoices. I have a script that when you press the 'Xero' button, the 'Xero' invoice open in a web browser.


      However, only a couple of users have Xero logins. These users have a 1 in the Users::Xero_admin field. How can I have a condition which says,


      If the current user (Get ( UserName )) has a '1' in the Users::Xero_admin, let them perform an action etc.

        • 1. Re: User properties

          First off: don't use Get(UserName); that is the name that is set in the FM application preference and anyone can change it any time.  If you have used this function in any security related functionality then redo that first.


          Get(AccountName) is the name of the account that is currently logged in.


          If you have a user table with preferences like this then a quick way to collect the flag is to use ExecuteSQL() to get the value for the Xero_admin field for that user's record.  That saves you from having to build relationships to the user table from different contexts.


          Of course you could also leverage the custom extended privileges of the privilege set and avoid using a user table for this kind of setting.  That would be considered more secure.

          1 of 1 people found this helpful
          • 2. Re: User properties

            I would use a hide condition on the Xero button, based upon Users::Xero_admin.


            He who not have, no see.

            1 of 1 people found this helpful
            • 3. Re: User properties

              And when you use either ExecuteSQL, a Scripted find, or a Relationship to determine whether the current user has this option specified, put that info into a global variable or field so that you only do this once when the user first accesses the file. The value of the global variable or field is then accessible from any context in your file so you can use it in Hide Object When or in a script without having to do that query all over again.

              1 of 1 people found this helpful
              • 4. Re: User properties

                A bit more complicated that I expected. I will have a look into this. Thanks for all your help.