The GlideCurrencyConfig API provides methods to retrieve various configuration information for FX Currency fields.

You can acquire information for a specific FX Currency field by calling the GlideCurrencyConfig(Object ed) constructor, which associates a specific FX Currency field to the instantiated object. When calling the various GlideCurrencyConfig() methods, if a record exists in the FX Currency Configuration [fx_configuration] table for the FX Currency field, the requested value is passed back. If a record or field is not available, the default value is passed back. You can also acquire the default FX Currency configuration values by calling the GlideCurrencyConfig() constructor.

For additional information on FX Currency configuration, see Setting up and operating FX Currency fields.

This class runs is in the sn_currency namespace.

GlideCurrencyConfig - GlideCurrencyConfig()

Instantiates a GlideCurrencyConfig object that enables the retrieval of global default FX Currency configuration information.

When calling the available methods on this type of GlideCurrencyConfig object, the return values are the FX Currency global defaults from system properties. If a global default is not defined in system properties, a hard-coded default is returned (this can also be an empty value if not configured).

This object does not provide configuration information for a specific FX Currency field. To retrieve specific FX Currency field information, use the GlideCurrencyConfig(Object ed) constructor.

For more information, see Configuring FX Currency global settings.

Table 1. Parameters
Name Type Description
None

Example

var cur_config = new sn_currency.GlideCurrencyConfig();

GlideCurrencyConfig - GlideCurrencyConfig(Object ed)

Instantiates a GlideCurrencyConfig object that enables the retrieval of the configuration information for a specific FX Currency field.

When calling the available methods on this type of GlideCurrencyConfig object, the return values are from the FX Currency Configuration [fx_configuration] record associated with the FX Currency field, if a record exists. If a record does not exist, default values are returned.

For more information, see Configuring FX Currency global settings.

Table 2. Parameters
Name Type Description
ed GlideElementDescriptor GlideElementDescriptor object of the FX Currency field to associate with the GlideCurrencyConfig object.

Example

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);

GlideCurrencyConfig - getAggregationSource()

Returns the aggregation source value for an FX Currency field.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value of the Aggregation Source (aggregation_source) field. Otherwise, if a new record, returns a default value.

For more information on aggregation source, see Specify the table field and its currency display parameters.

Table 3. Parameters
Name Type Description
None
Table 4. Returns
Type Description
String Source of values for aggregations. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the aggregation_source field from the fx_configuration record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): If set, returns the value in the glide.currency2.aggregation_source field in system properties. Otherwise, returns a hard-coded default of reference.
Possible values:
  • default
  • as_entered
  • reference

Example

This code example returns the default aggregation source.

var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_agg_source = cur_config.getAggregationSource();

Example

This code example returns the aggregation source for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_agg_source = cur_config.getAggregationSource();

GlideCurrencyConfig - getConversionDateSource()

Returns the field used as the source of the date and time for the currency conversion.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value of the Conversion Date Source (conversion_date_source) field. Otherwise, if a new record, returns "null".

For more information on the Conversion Date Source field, see Identify the rate table and date source for currency conversions.

Table 5. Parameters
Name Type Description
None
Table 6. Returns
Type Description
String Field in the record used as the conversion date source. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the conversion_date_source field from the fx_configuration record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): Returns null.

Example

This code example returns the conversion date source for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_conv_date_src = cur_config.getConversionDateSource();

GlideCurrencyConfig - getDisplayDigits()

Returns the number of digits to display for an FX Currency field.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value of the Display Digits (display_digits) field. Otherwise, if a new record, returns a default value.

Table 7. Parameters
Name Type Description
None
Table 8. Returns
Type Description
Number Number of digits to display for the FX Currency field. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the value of the display_digits field in the FX Currency Configuration [fx_configuration] record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): If set, returns the value of the glide.currency2.display_digits property in system properties. Otherwise, returns -1.

Example

This code example returns the default number of display digits.

var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_display_digits = cur_config.getDisplayDigits();

Example

This code example returns the display digits for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_display_digits = cur_config.getDisplayDigits();

GlideCurrencyConfig - getDisplayValue()

Returns the currency code used to convert the FX Currency value when it appears in lists and reports.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value of the Display Value Currency (display_value) field. Otherwise, if a new record, returns a default value.

Table 9. Parameters
Name Type Description
None
Table 10. Returns
Type Description
String Currency code to use to display the FX Currency field. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the display_value field, which contains the currency code, from the fx_configuration record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): If set, returns the value of the glide.currency2.display_value property in system properties. Otherwise, returns as_entered.
Possible values:
  • default: Global default. This is the value in the glide.currency2.display_digits property.
  • as_entered: Currency value as entered by the user.
  • in_session_currency: Currency value converted to the session currency. Session currency is based on the user's locale.
  • in_reference_currency: Reference value if computed and stored. Otherwise, the currency value converted to the reference currency.

Example

This code example returns the default currency code.

var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_display_value = cur_config.getDisplayValue();

Example

This code example returns the display currency code for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_display_value = cur_config.getDisplayValue();

GlideCurrencyConfig - getRateFilterRateTableField()

Returns the rate table field used as a rate table filter for an FX Currency field.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value of the Rate Table Field (rate_filter_rate_table_field). Otherwise, if a new record, returns a default value.

For more information on rate table filters, see Select the rate and target table fields used for filtering.

Table 11. Parameters
Name Type Description
None
Table 12. Returns
Type Description
String Field in the rate table used to filter the rate table records. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the rate_filter_rate_table_field from the fx_configuration record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): Returns null.

Example

This code example returns the rate table field used to filter rate table records for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_reference_currency = cur_config.getRateFilterRateTableField();

GlideCurrencyConfig - getRateFilterTargetTableField()

Returns the target table field used to filter the rate table records for an FX Currency field.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value of the Target Table Field (rate_filter_target_table_field). Otherwise, if a new record, returns a default value.

For more information on rate table filters, see Select the rate and target table fields used for filtering.

Table 13. Parameters
Name Type Description
None
Table 14. Returns
Type Description
String Field in the target table used/to use to filter the rate table. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the rate_filter_target_table_field from the fx_configuration record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): Returns null.

Example

This code example returns the default rate filter, target table field.

var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_rate_filter = cur_config.getRateFilterTargetTableField();

Example

This code example returns the rate filter, target table field for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_rate_filter = cur_config.getRateFilterTargetTableField();

GlideCurrencyConfig - getRateTable()

Returns the rate table used to convert currency for an FX Currency field.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value of the Rate Table Field (rate_filter_rate_table_field). Otherwise, if a new record, returns a default value.

For more information on FX Currency rate tables, see Identify the rate table and date source for currency conversions.

Table 15. Parameters
Name Type Description
None
Table 16. Returns
Type Description
String Name of the rate table used to perform the currency conversion. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the rate_table_field field from the fx_configuration record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): If set, returns the value of the glide.currency2.system_rate_table property from system properties. Otherwise, returns fx_system_rate.

Example

Returns the default rate table.

var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_rate_table = cur_config.getRateTable();

Example

Returns the rate table used for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_rate_table = cur_config.getRateTable();

GlideCurrencyConfig - getReferenceCurrency()

Returns the reference currency for an FX Currency field.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value of the Reference Currency (reference_currency) field. Otherwise, if a new record, returns a default value.

For more information on reference currency, see Set the reference currency.

Table 17. Parameters
Name Type Description
None
Table 18. Returns
Type Description
String Reference currency as an ISO currency code. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the reference_currency field from the fx_configuration record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): If set, returns the value of the glide.currency2.default_reference_currency system property. Otherwise the method applies the following rules, in the specified order, to determine the reference currency code:
    • If the glide.system.reference_currency system property is set to true, uses the value in the glide.system.reference_currency.code system property.
    • The value in the glide.system.locale system property (which implies a currency).
    • Default locale of the Java Virtual Machine on which the instance is running.

Example

This code example returns the default reference currency.

var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_reference_currency = cur_config.getReferenceCurrency();

Example

This code example returns the reference currency for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_reference_currency = cur_config.getReferenceCurrency();

GlideCurrencyConfig - getReferenceCurrencySource()

Returns the reference currency source for an FX Currency field.

If called on an existing FX Currency field that has a corresponding FX Currency Configuration [fx_configuration] record, returns the value (dot-walk path) of the Reference Currency Source (reference_currency_source) field. Otherwise, if a new record, returns a default value.

For more information on reference currency source, see Set the reference currency.

Table 19. Parameters
Name Type Description
None
Table 20. Returns
Type Description
String Dot-walk path of the field used/to use as the reference currency. The returned value depends on the constructor used to instantiate the object.
  • GlideCurrencyConfig(Object ed): If an fx_configuration record exists, returns the reference_currency_source field from the fx_configuration record that is associated with the FX Currency field specified by the GlideElementDescriptor passed in the constructor. If no fx_configuration record, follows the GlideCurrencyConfig() rules.
  • GlideCurrencyConfig(): Returns null.

Example

This code example returns the default reference currency source.

var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_reference_currency = cur_config.getReferenceCurrencySource();

Example

This code example returns the reference currency source for a specific FX Currency field.

var grCurr = new GlideRecord('my_FXCurrency_table');
var curr_field = grCurr.getElement('currency');
var ed = curr_field.getED();
var cur_config = new sn_currency.GlideCurrencyConfig(ed);
var curr_reference_currency = cur_config.getReferenceCurrencySource();