{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":777,"path":"api-reference/server-api-reference/GlideCurrencyConfigScopedAPI.md","title":"GlideCurrencyConfig - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# GlideCurrencyConfig- Scoped\n\nThe GlideCurrencyConfig API provides methods to retrieve various configuration information for FX Currency fields.\n\nYou can acquire information for a specific FX Currency field by calling the [GlideCurrencyConfig\\(Object ed\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideCurrencyConfigScopedAPI.md) 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\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideCurrencyConfigScopedAPI.md) constructor.\n\nFor additional information on FX Currency configuration, see [Setting up and operating FX Currency fields](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/fx-currency.md).\n\nThis class runs is in the `sn_currency` namespace.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## GlideCurrencyConfig - GlideCurrencyConfig\\(\\)\n\nInstantiates a GlideCurrencyConfig object that enables the retrieval of global default FX Currency configuration information.\n\nWhen 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\\).\n\nThis object does not provide configuration information for a specific FX Currency field. To retrieve specific FX Currency field information, use the [GlideCurrencyConfig\\(Object ed\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/GlideCurrencyConfigScopedAPI.md) constructor.\n\nFor more information, see [Configuring FX Currency global settings](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/fx-currency-configure.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n```api-constructor\nvar cur_config = new sn_currency.GlideCurrencyConfig();\n```\n\n## GlideCurrencyConfig - GlideCurrencyConfig\\(Object ed\\)\n\nInstantiates a GlideCurrencyConfig object that enables the retrieval of the configuration information for a specific FX Currency field.\n\nWhen 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.\n\nFor more information, see [Configuring FX Currency global settings](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/fx-currency-configure.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|ed|GlideElementDescriptor|GlideElementDescriptor object of the FX Currency field to associate with the GlideCurrencyConfig object.|\n\n```api-constructor\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\n```\n\n## GlideCurrencyConfig - getAggregationSource\\(\\)\n\nReturns the aggregation source value for an FX Currency field.\n\nIf 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.\n\nFor more information on aggregation source, see [Specify the table field and its currency display parameters](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/configure-fx-currency-field-behavior.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_zvy_j1r_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nSource 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.\n-   GlideCurrencyConfig\\(\\): If set, returns the value in the glide.currency2.aggregation\\_source field in system properties. Otherwise, returns a hard-coded default of `reference`.\n\n Possible values:\n\n-   default\n-   as\\_entered\n-   reference\n\n</td></tr></tbody>\n</table>This code example returns the default aggregation source.\n\n```\nvar cur_config = new sn_currency.GlideCurrencyConfig();\nvar curr_agg_source = cur_config.getAggregationSource();\n```\n\nThis code example returns the aggregation source for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_agg_source = cur_config.getAggregationSource();\n```\n\n## GlideCurrencyConfig - getConversionDateSource\\(\\)\n\nReturns the field used as the source of the date and time for the currency conversion.\n\nIf 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\".\n\nFor more information on the Conversion Date Source field, see [Identify the rate table and date source for currency conversions](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/configure-fx-currency-field-behavior.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_ddl_yyq_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nField 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.\n-   GlideCurrencyConfig\\(\\): Returns `null`.\n\n</td></tr></tbody>\n</table>This code example returns the conversion date source for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_conv_date_src = cur_config.getConversionDateSource();\n```\n\n## GlideCurrencyConfig - getDisplayDigits\\(\\)\n\nReturns the number of digits to display for an FX Currency field.\n\nIf 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_qxs_myp_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nNumber\n\n</td><td>\n\nNumber 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.\n-   GlideCurrencyConfig\\(\\): If set, returns the value of the glide.currency2.display\\_digits property in system properties. Otherwise, returns `-1`.\n\n</td></tr></tbody>\n</table>This code example returns the default number of display digits.\n\n```\nvar cur_config = new sn_currency.GlideCurrencyConfig();\nvar curr_display_digits = cur_config.getDisplayDigits();\n```\n\nThis code example returns the display digits for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_display_digits = cur_config.getDisplayDigits();\n```\n\n## GlideCurrencyConfig - getDisplayValue\\(\\)\n\nReturns the currency code used to convert the FX Currency value when it appears in lists and reports.\n\nIf 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.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_ftg_bsk_qjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nCurrency 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.\n-   GlideCurrencyConfig\\(\\): If set, returns the value of the glide.currency2.display\\_value property in system properties. Otherwise, returns `as_entered`.\n\n Possible values:\n\n-   default: Global default. This is the value in the glide.currency2.display\\_digits property.\n-   as\\_entered: Currency value as entered by the user.\n-   in\\_session\\_currency: Currency value converted to the session currency. Session currency is based on the user's locale.\n-   in\\_reference\\_currency: Reference value if computed and stored. Otherwise, the currency value converted to the reference currency.\n\n</td></tr></tbody>\n</table>This code example returns the default currency code.\n\n```\nvar cur_config = new sn_currency.GlideCurrencyConfig();\nvar curr_display_value = cur_config.getDisplayValue();\n```\n\nThis code example returns the display currency code for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_display_value = cur_config.getDisplayValue();\n```\n\n## GlideCurrencyConfig - getRateFilterRateTableField\\(\\)\n\nReturns the rate table field used as a rate table filter for an FX Currency field.\n\nIf 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.\n\nFor more information on rate table filters, see [Select the rate and target table fields used for filtering](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/configure-fx-currency-field-behavior.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_olm_5cr_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nField 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.\n-   GlideCurrencyConfig\\(\\): Returns `null`.\n\n</td></tr></tbody>\n</table>This code example returns the rate table field used to filter rate table records for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_reference_currency = cur_config.getRateFilterRateTableField();\n```\n\n## GlideCurrencyConfig - getRateFilterTargetTableField\\(\\)\n\nReturns the target table field used to filter the rate table records for an FX Currency field.\n\nIf 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.\n\nFor more information on rate table filters, see [Select the rate and target table fields used for filtering](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/configure-fx-currency-field-behavior.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_a2y_gcr_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nField 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.\n-   GlideCurrencyConfig\\(\\): Returns `null`.\n\n</td></tr></tbody>\n</table>This code example returns the default rate filter, target table field.\n\n```\nvar cur_config = new sn_currency.GlideCurrencyConfig();\nvar curr_rate_filter = cur_config.getRateFilterTargetTableField();\n```\n\nThis code example returns the rate filter, target table field for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_rate_filter = cur_config.getRateFilterTargetTableField();\n```\n\n## GlideCurrencyConfig - getRateTable\\(\\)\n\nReturns the rate table used to convert currency for an FX Currency field.\n\nIf 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.\n\nFor more information on FX Currency rate tables, see [Identify the rate table and date source for currency conversions](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/configure-fx-currency-field-behavior.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_ntg_knq_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nName 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.\n-   GlideCurrencyConfig\\(\\): If set, returns the value of the glide.currency2.system\\_rate\\_table property from system properties. Otherwise, returns `fx_system_rate`.\n\n</td></tr></tbody>\n</table>Returns the default rate table.\n\n```\nvar cur_config = new sn_currency.GlideCurrencyConfig();\nvar curr_rate_table = cur_config.getRateTable();\n```\n\nReturns the rate table used for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_rate_table = cur_config.getRateTable();\n```\n\n## GlideCurrencyConfig - getReferenceCurrency\\(\\)\n\nReturns the reference currency for an FX Currency field.\n\nIf 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.\n\nFor more information on reference currency, see [Set the reference currency](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/configure-fx-currency-field-behavior.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_tmf_qqq_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nReference 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.\n-   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:\n    -   If the glide.system.reference\\_currency system property is set to true, uses the value in the glide.system.reference\\_currency.code system property.\n    -   The value in the glide.system.locale system property \\(which implies a currency\\).\n    -   Default locale of the Java Virtual Machine on which the instance is running.\n\n</td></tr></tbody>\n</table>This code example returns the default reference currency.\n\n```\nvar cur_config = new sn_currency.GlideCurrencyConfig();\nvar curr_reference_currency = cur_config.getReferenceCurrency();\n```\n\nThis code example returns the reference currency for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_reference_currency = cur_config.getReferenceCurrency();\n```\n\n## GlideCurrencyConfig - getReferenceCurrencySource\\(\\)\n\nReturns the reference currency source for an FX Currency field.\n\nIf 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.\n\nFor more information on reference currency source, see [Set the reference currency](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/configure-fx-currency-field-behavior.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_zsb_swq_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nDot-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.\n-   GlideCurrencyConfig\\(\\): Returns `null`.\n\n</td></tr></tbody>\n</table>This code example returns the default reference currency source.\n\n```\nvar cur_config = new sn_currency.GlideCurrencyConfig();\nvar curr_reference_currency = cur_config.getReferenceCurrencySource();\n```\n\nThis code example returns the reference currency source for a specific FX Currency field.\n\n```\nvar grCurr = new GlideRecord('my_FXCurrency_table');\nvar curr_field = grCurr.getElement('currency');\nvar ed = curr_field.getED();\nvar cur_config = new sn_currency.GlideCurrencyConfig(ed);\nvar curr_reference_currency = cur_config.getReferenceCurrencySource();\n```\n\n"}}