Configuring dynamic references to external systems by using the Global Resource Settings feature
When you migrate applications from one server or environment to another, references to the external systems that those applications connect to, such as endpoint URLs and JNDI servers, might change. By using the Global Resource Settings feature, you can set values for these references without hard coding them into your application.
The following task describes how to create the classes, properties, data transforms, and data pages required to implement the Global Resource Settings feature. As a best practice, create application settings and reference the settings in your fields. Application settings provide a simple model for storing and organizing the environment-specific settings in your application. Use Global Resource Settings only for fields that do not support application settings. For more information, see Creating an application setting and Categorizing application settings.
Beginning in Pega Platform 8.5, you can use the Pega-provided D_pxGetApplicationSettingValue data page to fetch the values for specific application settings in the fields that support Global Resource Settings. For a list of supported fields, see Fields that support the Global Resource Settings syntax.
For example, to obtain a value from an application setting, use the following syntax: =D_pxGetApplicationSettingValue[OwningRuleset:"PegaUnitTests:01-01-01",Purpose:"URLSetting"].pySettingValue
If you use the D_pxGetApplicationSettingValue data page, skip steps 2 through 5 in the following task.
Determine the references to external systems that will use the Global Resource Settings feature. For a list of supported reference types, see Fields that support the Global Resource Settings syntax.
Create a class to hold the references to external systems. These references are also known as environment properties. A page of that class becomes the data page for the application. For more information, see Creating classes.You can create embedded pages in this class by using existing class definitions that are intended for this purpose. For a list of the existing embedded classes that you can use for this configuration, see Embedded classes and default environment properties
Create the environment property for each reference to an external system. Pega Platform includes standard embedded classes and default properties for each rule form that supports the Global Resource Settings syntax. For more information on how to create a property, see Properties.
Set the values of the environment properties. As a best practice, use a data transform to store these values. You must create at least one data transform to assign values to the environment properties. For more information, see Configuring a data transform.
Create a data page rule that references the class from Step 2 and the data transform from Step 4. The data page brings the environment property rules together with the values that are stored in the data transform, and writes those property/value pairs to the clipboard. For more information, see Creating a data page.
After you have set up the values for your Global Resource Settings, use the Global Resource Settings syntax to refer to these values when entering references to external systems.=PageName.PropertyNamePageName is the name of the data page that you created in step 5, and PropertyName is one of the properties that you created in step 3. For example, if you want to use the Global Resource Settings syntax to refer to a SOAP Service Endpoint URL, and your data page is named MyDeclarativePage, the reference is =MyDeclarativePage.pySOAPURL. At run time, the reference resolves to the value of the pySOAPURL property that is located on the specified data page.
For a list of fields, see Fields that support the Global Resource Settings syntax.
- Embedded classes and default environment properties
The following table lists the Embed-Env classes included in Pega Platform, and the default environment properties that each class contains. By using the Pega-provided environment properties, you eliminate the need to create your own classes and properties, and save time. The default environment properties support the Global Resource Settings syntax.
- Utility functions for the Global Resource Settings feature
Standard utility functions gather environment property values and encode passwords. You can call these functions in your data transforms.
- Fields that support the Global Resource Settings syntax
The following table lists fields that support the Global Resource Settings syntax (= PageName.PropertyName ) for references to external systems, and the default properties that are associated with those fields. You can refer to properties that you have created rather than the default properties.