0

I want to convert the amount field in opportunity object to the corporate currency, I found that the convertCurrency(amount) will give me the value in user's currency format, but I found that the user's currency does not corresponds to CurrencyISOCode instead it converts to corporate currency, does user's currency here refers to corporate currency, Is it right to use convertCurrency() to convert the value to the corporate currency?

sample data which I fetched for the opportunity object, here format_amt is an alias for FORMAT(amount) and convert_amt is an alias for convertCurrency(amount)

     "Id": "123321212122",
            "CurrencyIsoCode": "EUR",
            "Owner": {
                "attributes": {
                    "type": "User",
                    "url": "/services/data/v53.0/sobjects/User/00550000003DYHKAA4"
                },
                "DefaultCurrencyIsoCode": "EUR"
            },
            "format_amt": "EUR 1,522.95 (USD 2,097.71)",
            "Amount": 1522.95,
            "convert_Amt": 2097.71

so here I get the convertCurrency(amount) in USD format though the CurrencyIsoCode is EUR

6
  • Welcome to SFSE. Please see How to Ask on getting the most from the Community. this might be of assistance
    – cropredy
    Commented Dec 16, 2021 at 5:14
  • Hi @cropredy, Thanks for your comment, I found that convertCurrency will convert based on the user's running currency, but I got the data where the convertCurrency converts to USD even if the currencyISOCode or DefaultcurrencyISOCode is not USD, so my question is, is the running user's currency is currencyISOcode or is it any other field we can see this or convertCurrency convert to corporate currency (which is USD in my case)
    – R_M_R
    Commented Dec 16, 2021 at 6:24
  • Running user’s currency is defined in their User record.
    – cropredy
    Commented Dec 16, 2021 at 6:51
  • Do you mean the DefaultcurrencyISOCode, as that is the only currency field in User record, If so then the ConvertCurrency() should have converted the amount to EUR as per above sample data, but it converts to USD instead
    – R_M_R
    Commented Dec 16, 2021 at 8:01
  • I found currencyISOCode in api from User object and convertCurrency() converts based on the currencyISOCode value in User. is there a function or a way I can convert the value to corporate Currency?
    – R_M_R
    Commented Dec 16, 2021 at 8:17

0

You must log in to answer this question.