Loading...
 

The Global Variables module permits the implementor, administrator, and users to customize the behavior of the application to their requirements, taking the configuration and customization of coreBOS to a whole new level.

This module permits us to customize the functionality of the application in a very easy way. The basic idea is that when we are programming something and need to establish a value or a decision, we create a global variable with a default value and use the result. So now any user can set the global variable to another value and effectively modify the program logic without having to modify the code. A really powerful and easy extension.

Global Variables Reference

The list of variables is fully documented in the module itself. On the list view, there is a button to access the table, on the detail and edit view there is a block that contains a table with all the variables, their possible values and an explanation of what each is for.

 

image

 

Fields

 

image

 

  • Global Variable Name. This is a list of existing variables. It is a select box with the accepted values.

  • Value. It is a string field that holds the actual value to be used for this variable. Each variable has its own possible values which are documented in the module. There is a special value accepted by all variables which is Use Description. Some variables have very long values, for example, Application_UserLoginIPs can be a long string of values. To make maintaining these long values easier you can put a value in the description field instead of the value field by setting the value to Use Description.

  • User. the user this variable is for

  • Default. This checkbox is contrary to Mandatory. It permits the administrator to set a default value for all users but it can be overridden by any user who wants to have a different value. The record marked as Default will only be used if no other record is found

  • Mandatory. This checkbox forces the value of the variable for all users. If it is checked no other record for this variable will be used. It is designed for the administrator to be able to set a variable globally for all users. To accomplish this you must set the module to private sharing and assign the record to the admin user so it can't be modified by any user.

  • Blocked: this field is simply for grouping certain variables together, it has no logic nor process associated. The use case this field was created for was for the admin user to be able to hide it in all profiles or not permit editing of the field so he can use it to group certain important variables together. Once those variables are ticked we can easily create a filter or search on the field so we can find them quickly.

  • Module and In Module List. Variable values can be applied per module with these two fields. If the module list field is checked then the defined value will be applied only to the modules selected in the module multi-picklist field

  • Role. Select the roles you want to apply this variable too. If one or more roles are selected the Global variable MUST be assigned to a user in one of those roles. To help you with that coreBOS will automatically assign it to one if you haven't

  • Business Map. When we look for business maps in the code we do that through the global variable module instead of going directly to the business map module. This way we permit any user to override the default selection and set a specific mapping for any case.

  • Category. Simply for organization purposes, so you can group and filter your variable records

 The order Global Variables used to return a value is:

  • First, it looks for a GV marked as 'mandatory'.

  • If none is found, it'll look for one assigned to the role of the current user.

  • If none is found, it'll look for one assigned to the current user

  • If none is found, it'll look for one assigned to the group of the current user.

  • Finally, it'll look for one that's marked as 'default'.

  • If no GV was set, the default system behavior will take place.

  • Additionally, the previous searches will take into consideration the checkbox 'In Module List'

Let's see two very relevant examples which have been among the most asked feature on the forum.

I want to activate a single pane view for one user on one module

Now that we have converted single pane mode to a global variable we can create a record for this variable assigned to the user with the In Module List field and the module selected.

Let's suppose that we want the single pane active on Accounts for the admin user. That will look like this:

 

Global Variable Single Pane on Accounts

 

It doesn't default nor mandatory and the definition is restricted to the Accounts module for this user. That easy!

I need to set the list view number of records for invoices to 100 for all users

We will select the In Module List field, select Invoices and set the default checkbox. Which looks like this:

 

Global Variable ListView Page Size on Invoice

 

With this record, any user can override this setting to their needs as we didn't make it mandatory.

Test your Global Variables Configuration

On the list and detail view, you will find a Test action that will permit you to validate the result of any variable on any module for any user. This is very useful when you have a lot of records for the same variable and need to make sure that the right value will be returned in each case.

 

Global Variable Validation Page

Global Variables Accessible from everywhere

Finally, I would like to add that we also made the global variable values accessible from inside the browser, in the JavaScript world and from the web service interface. In the browser we have a JavaScript promise that sets the value obtained from the application like this:

var calendar_call_default_duration = 5; // define the variable and set it's default value
GlobalVariable_getVariable('Calendar_call_default_duration', 5, 'Calendar', gVTUserID).then(function(response) {
   var obj = JSON.parse(response);
   calendar_call_default_duration = obj.Calendar_call_default_duration;  // set value from application
}, function(error) {
    calendar_call_default_duration = 5; // set default value on error
});
// You MUST give this some time to execute, so do not use the value at this line. Or execute your code inside the promise

 

Admin Manual
Developer Manual