• Install
  • Contribute
  • API Reference

Global Variables

Overview

Problem: You need global variables which persist across Apex instantiations, users and sessions.

Solution: Create a List Custom Setting object which accepts Name Value pairs.

Implementation

The implementation requires two resources. The first is a List Custom Settings object called GlobalVariable__c and a utility class GlobalVariable. Test coverage is in the GlobalVariableTest class.

Example Usage

  GlobalVariable.put('MyKey','My Value');
  System.debug('Here is the value: ' + GlobalVariable.get('MyKey'));

Description

Apex Classes

GlobalVariable__c GlobalVariable

  • Base

    • Collection Utilities
    • Exceptions
    • Platform Utilities
    • Sorting
    • String Manipulation
    • Type Conversion
    • Unit Test Helpers
  • Chatter

    • Chatter Follower Manipulations
  • Environment

    • Global Variables
  • Math

    • Randomization
    • Ranges
  • Query

    • Database Utilities
    • SOQL Builder
  • Sort

    • Sorting Primitives
    • Sorting Select Options
    • Sorting SObjects
  • Visualforce

    • Pagination

This website is open source. Please help us by forking the project and adding to it.