Order and Inventory Management Apex API Developer Reference

scmc.SCMCommonAPI

global with sharing class SCMCommonAPI

This class is used to support common helper methods across the Order and Inventory Management product suite.

Methods

getNumberDecimals

global static Integer getNumberDecimals()

Gets the default number of decimals for the organization.

Return Value

An interger that is the number of decimals set for the organization.

scaleAmount

global static Decimal scaleAmount(Decimal amount)

Scale an amount to the number of decimals that is set for the organization.

Input Parameters

Name Type Description
amount Decimal The amount that is to be scaled.

Return Value

The original amount scaled to the number of decimals that is set for the organization.

decimalFormatStringForLocale

global static String decimalFormatStringForLocale()

Create an editing map that reflects the number of decimals set for the organization. Will only work for US currency.

Return Value

A valid String for displaying price or cost fields that will format a parameter with appropriate punctuation and decimals.

formatDecimalForLocale

global static String formatDecimalForLocale(Decimal decimalValue)

Create an editing map that reflects the number of decimals set for the organization and the locale of the user.

Input Parameters

Name Type Description
decimalValue Decimal Amount that is to be formatted.

Return Value

A valid String of a decimal that is formatted with the appropriate punctuation and decimals.

convert

global static Decimal convert(Decimal amount, String fromCurrency, String toCurrency, Boolean scale)

Convert an amount from one currency to another. The conversion uses the current exchange rate in the Salesforce multi-currency definition.

Input Parameters

Name Type Description
amount Decimal The amount that is the value that you want to convert from one currency to another.
fromCurrency String The currency you are converting from. This is the name of a currency defined in Salesforce as a currency.
toCurrency String The currency you want to convert to. This is the name of a currency defined in Salesforce as a currency.
scale Boolean A boolean that indicates if you want the result of the conversion to be scaled to the organization number of decimals.

Return Value

A Decimal value that is the amount you specified converted to the new currency.

© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.