GlideCurrencyConfig - Scoped
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.
| Name | Type | Description |
|---|---|---|
| None |
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.
| Name | Type | Description |
|---|---|---|
| ed | GlideElementDescriptor | GlideElementDescriptor object of the FX Currency field to associate with the GlideCurrencyConfig object. |
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.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | Source of values for aggregations. The returned value depends on the
constructor used to instantiate the object.
Possible values:
|
This code example returns the default aggregation source.
var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_agg_source = cur_config.getAggregationSource();
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.
| Name | Type | Description |
|---|---|---|
| None |
| 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.
|
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.
| Name | Type | Description |
|---|---|---|
| None |
| 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.
|
This code example returns the default number of display digits.
var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_display_digits = cur_config.getDisplayDigits();
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.
| Name | Type | Description |
|---|---|---|
| None |
| 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.
Possible values:
|
This code example returns the default currency code.
var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_display_value = cur_config.getDisplayValue();
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.
| Name | Type | Description |
|---|---|---|
| None |
| 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.
|
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.
| Name | Type | Description |
|---|---|---|
| None |
| 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.
|
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();
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.
| Name | Type | Description |
|---|---|---|
| None |
| 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.
|
Returns the default rate table.
var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_rate_table = cur_config.getRateTable();
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.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | Reference currency as an ISO currency code. The returned value depends on the
constructor used to instantiate the object.
|
This code example returns the default reference currency.
var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_reference_currency = cur_config.getReferenceCurrency();
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.
| Name | Type | Description |
|---|---|---|
| None |
| 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.
|
This code example returns the default reference currency source.
var cur_config = new sn_currency.GlideCurrencyConfig();
var curr_reference_currency = cur_config.getReferenceCurrencySource();
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();