Configuration Values
Configuration values are system values that an application might need to run correctly in Relativity, which includes application paths, Relativity version, currency symbol, instance guid, and web resource filepaths.
There are two types of APIs available to retrieve configuration values:
- Property getters - grab the value from an object
- Function getters - grab the value from a function call. Most of these return promises, with the exception of getRelativityApplicationWebResourceFile.
Property Getters
We only support the use of the following three property getters within the window.relativity.config object:
- applicationPath: string
- restApplicationPath: string
- keplerApplicationPath: string
Only the three configuration values listed above are guaranteed to be available right when they are called. Use the function getters for the other configuration values.
Example:
function getRelativeLink(relativeUrl) {
return `${window.relativity.config.applicationPath}${relativeUrl}`
}
getRelativeLink('/test'); // "/Relativity/test"
Function Getters
The functions provided in window.relativity are the following:
- getCurrencySymbol(): Promise<string>
- getInstanceGuid(): Promise<string>
- getRelativityVersion(): Promise<string>
- getApplicationPath(): Promise<string> - resolves to value equivalent to window.relativity.config.applicationPath
- getRestApplicationPath(): Promise<string> - resolves to value equivalent to window.relativity.config.restApplicationPath
- getKeplerApplicationPath(): Promise<string> - resolves to value equivalent to window.relativity.config.keplerApplicationPath
- getRelativityApplicationWebResourceFile(appGuid: string, version: string, fileName: string): string - note that this returns a string and NOT a promise.
Each of these functions (with the exception of getRelativityApplicationWebResourceFile) returns a promise that resolves to the expected value after the corresponding value is obtained from the API call to retrieve them.
Examples:
// Example: Format the currency value with the currency symbol for the user
// using Promises
function formatCurrency(value) {
return window.relativity.getCurrencySymbol().then((currencySymbol) => {
return `${currencySymbol}${value}`
});
}
// using async/await
async function formatCurrency(value) {
const currencySymbol = await window.relativity.getCurrencySymbol();
return `${currencySymbol}${value}`
}
Deprecated Functions and Properties, and replacements
Deprecated Functions
The following functions on the global scope are deprecated. The Replacement column describes what should be used as the replacement. (Existing functionalities will work, but will log a warning via the compatibility layer)
Deprecated | Replacement |
---|---|
GetApplicationPath() | window.relativity.config.applicationPath: string or window.relativity.getApplicationPath(): Promise<string> |
GetRestApplicationPath() | window.relativity.config.restApplicationPath: string or window.relativity.getRestApplicationPath(): Promise<string> |
GetKeplerApplicationPath() | window.relativity.config.keplerApplicationPath: string or window.relativity.getKeplerApplicationPath(): Promise<string> |
GetRelativityApplicationCurrencySymbol() | window.relativity.getCurrencySymbol(): Promise<string> |
GetInstanceGuid() | window.relativity.getInstanceGuid(): Promise<string> |
GetRelativityVersion() | window.relativity.getRelativityVersion(): Promise<string> |
GetRelativityApplicationWebResourceFile() | window.relativity.getRelativityApplicationWebResourceFile(appGuid: string, version: string, fileName: string): string |
IsTabStripPerformanceImprovementsEnabled() | Deprecated, please use IToggleProvider |
IsActiveXSupported | Deprecated and should no longer be used since ActiveX is no longer supported. |
GetCsrfTokenFromPage | Deprecated and should no longer be used. Please use Kepler methods instead of ASMX/WebMethods. |
Deprecated Properties
The following properties on the global scope exist only for compatibility purposes and should not be used. Please use the promise-based functions instead.
Deprecated | Replacement |
---|---|
window.relativity.applicationPath | window.relativity.config.applicationPath: string or window.relativity.getApplicationPath(): Promise<string> |
window.relativity.currencySymbol | window.relativity.getCurrencySymbol(): Promise<string> |
window.relativity.instanceGuid | window.relativity.getInstanceGuid(): Promise<string> |
window.relativity.keplerApplicationPath | window.relativity.config.keplerApplicationPath: string or window.relativity.getKeplerApplicationPath(): Promise<string> |
window.relativity.relativityVersion | window.relativity.getRelativityVersion(): Promise<string> |
window.relativity.restApplicationPath | window.relativity.config.restApplicationPath: string or window.relativity.getRestApplicationPath(): Promise<string> |