We are running Financials 3.01.B / 3.10.A on SQL Server. We have multiple production, test, and development environments. The non-prod environments are relatively new, and users are occaisionally getting crossed up and working in the wrong environment. I’m trying to write a bit of code that will change the color of the main menu based on which server is being accessed. I know that there is a virtual table - Server - which has the name of the server. If I create a form, it displays the server name. But I can’t seem to programatically retrieve (GET or other) this server name to determine if it’s production or not. Has anyone written logic for this?
I can’t think of anything off the top of my head to get the Server Name. A couple of options might be: 1) Using the Company Name. It won’t work if you have the Same Company in all the environments, but that would be fairly dangerous on it’s own [:D] 2) Creating a field on the Company Setup table which has colour. This means that you need to set it once when you restore the company.
Perhaps it would help if the users have totally different usernames and passwords in the varoius environments. That is a solution we are using.
My solution was to paint the main menu in a horrible color on our test system, and add a message popup in the OnOpenForm trigger. I then saved the main menu to a fob file, and whenever we copy the production system over to the test system, I import this fob afterwards. Also, on the production system, whenever a user enters a test company (which we have in addition to the test server), a popup appears. No problems ever since… [;)]
Another way: 1. Create a Form on Table “20000047 Server” (this will be used as LookupForm) 2. Create a SetupTable like “SQL Server” (Code20), “Color MainMenue” (Integer) 3. Field “SQL Server” with TableRelation to “Server”. You have to programm the Lookup manually, therefore you have to use the form in 1. . 4. Create a Textbox on the MainMenue, because there you can use the “OnFormat”-Trigger where you can set the UPDATEFORECOLOR-Property. 5. Put some code in “OnOpenForm” of “MainMenue” that … gets the current server (Table “Server”, Field “My Server”) … looks up the Setuptable (2.), getting color number … sets UPDATEFORECOLOR of Textbox Maybe this would do the job … kind regards, Jörg
Thanks all for the great suggestions! Joerg’s solution is the type I am looking for, as it’s a ‘set it and forget it’ solution that won’t require any action when we copy production over to test or dev - which we frequently do. I will work on following your outlined steps. Thanks, Joerg!
Hi All, On Mibuso there is a How to? on getting the server names, is works fine for me. I display a text-box with the server name in the main menu, but offcourse colors will do the same trick.
Hi All, I think we can make use Of CONTEXTURL function alongwith other string related functions to get Server Name. Regards, Rajesh.