GlideCurrencyValue - Scoped

  • Release version: Washingtondc
  • Updated February 1, 2024
  • 1 minute to read
  • Provides methods that return the currency code and original currency from an associated GlideCurrencyParser.parse() call.

    This class runs is in the sn_currency namespace.

    Note:
    There is no constructor for this class.

    Scoped GlideCurrencyValue - getAmount()

    Returns the currency amount originally passed into the associated GlideCurrencyParser.parse() call.

    Table 1. Parameters
    Name Type Description
    None
    Table 2. Returns
    Type Description
    String Original currency passed into the parse() method.
    var gp = new sn_currency.GlideCurrencyParser(); 
    gp.setLocale("eng", "USA");  
    var cv = gp.parse("USD;1234.56"); 
    gs.info('Original currency amount: ' + cv.getAmount());
    

    Output:

    Original currency amount: 1234.56

    Scoped GlideCurrencyValue - getCurrencyCode()

    Returns the currency code used to parse the currency in the associated GlideCurrencyParser.parse() call.

    Table 3. Parameters
    Name Type Description
    None
    Table 4. Returns
    Type Description
    String Three-letter ISO currency code used to parse the currency.
    var gp = new sn_currency.GlideCurrencyParser(); 
    gp.setLocale(eng, USA); 
    var cv = gp.parse("USD";"1234.56"); 
    gs.info('Parsed currency code: ' + cv.getCurrencyCode());
    

    Output:

    Parsed currency code: USD