6 Replies Latest reply on Oct 31, 2011 2:44 PM by JamesLiang

    Can I Hide/Show Layout by AccountName



      Can I Hide/Show Layout by AccountName


      Hi Sir,

        How to write a script to let  the layout show/hide by accountname ? 



        • 1. Re: Can I Hide/Show Layout by AccountName

          Can you describe that in more detail?

          You have to show some layout or completely close the window. What do you want to happen when a given account name does not entitle the user to access to that layout?

          Depending on what you want, you may be able to set this up in Manage | Security by controlling what layouts are permitted for a given privilege set and then you assign privilege sets to different accounts to control layout access. However, more user friendly script triggers and such can be used to keep users from seeing grey layouts with access denied when they attempt to access a layout for which they do not have access privileges.

          • 2. Re: Can I Hide/Show Layout by AccountName

            Hi Phil,

              For example, when I created the detail records table and relation with master table, I don't want user can open the "detail records" table by

            any view except "Admin".

              I created a user priviliege on the DB security, so can I write like this on script :

            if [ Get ( CurrentPrivilegeSetName ) = "Guest_Privilege"

              Go to layout ["Master"(Master)]

            and set this script on "On Open".

            but how to avoid user click different layout on menu ?



            • 3. Re: Can I Hide/Show Layout by AccountName

              Shouldn't your script be this?

              If [ Get ( CurrentPrivilegeSetName ) = "[Full Access]"]
                Go to layout ["Master"(Master)]
              End IF

              Here's another option that does not require any scripting:

              Open layout set up for this layout and clear the Include in Layout Menus option.

              This removes the layout from the layout drop down when you are in browse mode. You'll only see the layout in this drop down when you enter layout mode, which requires a full access password to do so. You can still add buttons or your own drop down for navigating to layouts and these can also be set up to control access based on privilege set names.

              You can also open manage Security and deny access to this field for the "Guest_Privilege" privilege set. They can still select the layout if you leave it in the layouts drop down when in browse mode, but they'll see a grey screen and the text "access denied".

              The OnLayoutEnter script trigger for the master layout could also be set to run a script like this:

              If [ Get ( CurrentPrivilegeSetName ) ≠ "[Full Access]"
                Go to layout [//specify a different layout than the master layout.]
              End IF

              • 4. Re: Can I Hide/Show Layout by AccountName

                Mr Phil,

                  appreciate your help, I will follow up your suggestion to modify the script.

                now I have another question, when I re-open the fp7 file, system couldn't let me use admin to logon. so I couldn't modify anything.

                can you show me how to logon by admin under FM Pro Advance version and how to let user get a logon prompt when user logon this program ?



                • 5. Re: Can I Hide/Show Layout by AccountName

                  What did you specify in manage | security and Field options?

                  Usually, this happens when field options is set to open a file while automatically entering a limited access password. If this is what you did, hold down the option key (mac) or shift key (windows) while opening the file to force it to ask you for a password. Then you can enter the full access account name and password to regain developer level access.

                  When first experimenting with Manage Security settings, you may find it a good idea to save a back up copy of your file made just before you change these settings so you can toss out the current copy and revert to the back up if you get unexpected results after making changes to these settings.

                  • 6. Re: Can I Hide/Show Layout by AccountName

                    Mr. Phil,

                      Thanks a lot, I press "Shift" key to open the file, it's working now.


                    Thanks again.