Contents
When to use convertcurrency in soql query?
Use convertCurrency () in the SELECT statement of a SOQL query to convert currency fields to the user’s currency. This action requires that the org has multiple currencies enabled. The following syntax is for using convertCurrency () with the SELECT clause:
Can a aggregate function be converted to a user’s currency?
You can’t convert the result of an aggregate function into the user’s currency by calling the convertCurrency () function. If a query includes a GROUP BY or HAVING clause, currency data returned by using an aggregate function, such as SUM () or MAX (), is in the org’s default currency.
Can you use ISO codevalue to represent a currency?
If a query includes a GROUP BY or HAVING clause, currency data returned by using an aggregate function, such as SUM () or MAX (), is in the org’s default currency. You can’t use ISO_CODEvalue to represent a value in a particular currency, such as USD, when you use an aggregate function.
How to use convertcurrency with SELECT clause in Salesforce?
The following syntax is for using convertCurrency () with the SELECT clause: Use an ISO code that your org has enabled and made active. If you don’t put in an ISO code, the numeric value is used instead of comparative amounts. Using the previous example, opportunity records with JPY5001, EUR5001, and USD5001 would be returned.
How does the currency field work in Salesforce?
Currency fields in reports are shown in their original currencies. Salesforce gives the option to get the values in the Opportunity record currency and in the converted amount — by default, when creating a report, the converted currency will be in the user personal currency, but the user will be able to change to any active currency.
When to use dated exchange rates in Salesforce?
If an org has enabled advanced currency management, dated exchange rates are used when converting currency fields on opportunities, opportunity line items, and opportunity history. With advanced currency management, convertCurrency uses the conversion rate that corresponds to a given field (for example, CloseDate on opportunities ).
How to compare two fields in a soql query?
I have an object named “Filed Comparision” with fields “Start Date” and “End Date”. My requirement is to get all the records from the “Field Comparison” having End Date greater then Start Date.
Can a custom formula field be associated with a currency?
Custom formula fields that use currencies aren’t associated with any particular currency. If your organization has multi-currency enabled, the result of a currency formula displays in the currency of the associated record.
What does the equals operator do in soql?
From above SOQL statement the equals ” = ” checks whether the values of the two operands are equal. If the value is equal, the condition becomes ” TRUE ” . If not the condition Fails. Not Equals Operator.
How to fetch parent record in apex soql?
Fetch the Parent record’s value along with the child object. Here we have used the notation APEX_Customer__r.Name, where APEX_Customer__r is parent relationship name, here you have to append the __r at the end of the Parent field and then you can fetch the parent field value. SOQL does have aggregate function as we have in SQL.
How to format a currency in a where clause?
If you use IN in a WHERE clause, you can’t mix ISO code and non-ISO code values. To format currencies according to the user’s locale, use FORMAT () with SELECT () statements. In this example, convertedCurrency is an alias for the returned amount, which is formatted appropriately in the user interface.