Skip to content

Display Currency Values Based on the Running User of a Report

In multi-currency organizations, reports have an option to set a currency. This value is automatically set to the currency specified for the user who creates and saves a report. There is no “dynamic” option available in the report builder that allows a report to use the currency specified for the running user. But what if you want to create one report that serves users in various currencies? Wouldn’t it be nice to set up a single dashboard and have it work for any user no matter which currency they operate in?

I set out to solve this problem. The documentation states “In reports, the primary currency reflects either the default corporate currency or the currency selected for the record. The secondary currency reflects the personal default currency of the user running the report, or the currency specified in the report criteria.

Since that last statement is either/or, I thought “what if I remove the currency specified on the report?” I dove into the XML metadata of the report, removed the <currency> property, deployed the change back into my sandbox, and found that the report started automatically toggling the currency to match the running user.

This holds true for summary values shown in the currency field as well as all values shown in the corresponding “(converted)” field. When using these reports as the source for dashboard components, the currency fields continue to be dynamic as long as the dashboard is set up to run as the logged-in user.

It seems this is officially supported in the metadata based on the documentation, but there isn’t a way to set this in the report builder. Vote for this idea to make this native functionality. Until then, you can follow these steps in order to edit the metadata of your report.

Create a manifest file

Create a manifest file that specifies the reports you want to edit.

  1. Copy the below text into a text editor such as Notepad.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>REPORTFOLDERAPINAME/REPORTAPINAME</members>
        <name>Report</name>
    </types>
    <version>50.0</version>
</Package>

2. If you’d like to edit multiple reports simultaneously, add an additional <members> line for each report.
3. Replace “REPORTFOLDERAPINAME” with the API name of the report folder. Replace “REPORTAPINAME” with the API name of the report you want to edit. Be sure to leave a forward slash (/) between those two API names.

  • you can find the API name for a report folder by going to the “Rename” option for a report folder and copying the “Folder Unique Name”
  • you can find the API name for a report by going to the “Properties” option for a report and copying the “Report Unique Name”

4. Save the file with the name “package.xml” (be sure to choose “All files” for the “Save as type” option when using Notepad)

Workbench Method for Editing Metadata

Use Metadata API to retrieve and deploy using Workbench

Here is the “currency” property in the report metadata definition that needs to be removed
  1. Login to https://workbench.developerforce.com/ using your Production or Sandbox credentials
  2. Under “Migration” choose “Retrieve”
  3. Click “Choose File” and select the manifest file you created above
  4. Click “Next”, then click “Retrieve”
  5. Download the zip file by clicking the link
  6. Extract the contents of the .zip folder
  7. Navigate to the “reports” folder, then the folder you retrieved, then open the report definition file using a text editor
  8. Find the line that starts with “<currency>” (use Ctrl-F or Cmd-F to search). Remove that entire line including the line break so that there is no gap. Be careful not to adjust any other code
  9. Save the new version
  10. Navigate back up to the root folder where you will find the “unpackaged” folder as the only item
  11. Create a zip file of this “unpackaged” folder
  12. In workbench, under “Migration” choose “Deploy”
  13. Click “Choose File” and select the zip folder you created above
  14. Click “Next”
    1. for Sandbox environments, you can leave all the default settings
    2. for Production environments, set the following options:
      1. Rollback On Error = true
      2. Test Level = RunLocalTests
  15. Click “Deploy”

Command Line Interface (CLI) Method for Editing Metadata

If you are already set up with a command line interface (using a tool like Visual Studio Code) for managing Salesforce metadata, this is an easy task. Simply retrieve the metadata definition for the report(s) in question using the manifest file created above, remove the line that specifies the <currency> property from each xml file, save, then deploy the new version back to your org.

Getting set up with a CLI can be a bit tricky, but is well worth it if you intend to make adjustments to metadata on a regular basis. Follow one of these tutorials to install the necessary programs and extensions:

To retrieve:

  1. Authenticate to the desired org
  2. Right-click on the manifest file you created and choose “SFDX: Retrieve Source from Org”
  3. Then follow steps 8 and 9 from the section above to edit the metadata files and save them

To deploy:

  • For Sandbox environments, use the normal deploy command by right-clicking the manifest file and choosing “SFDX: Deploy Source to Org”
  • For Production environments, try the above command, then click on the “Terminal” tab, press the “up” arrow on your keyboard, append ” –testlevel RunLocalTests” to the deploy command, and press “Enter”

Note: If you perform this change in the metadata, then later edit the report via the report builder and click “save”, a static currency setting will again be specified. You will have to remove the <currency> property from the metadata again after editing a report in order for currencies to be displayed dynamically.

Evan Ponter View All

Evan Ponter is a Salesforce Admin Hero from Baltimore, MD who has been focusing on declarative development since 2012. His desire to keep an org simple, streamlined, and maintainable by future admins has led him to being an expert on the declarative features of the platform. A deep understanding of reports, the importance of proper data modeling, and the utilization of declarative automation tools have propelled Evan along a blossoming Salesforce journey where he solves complex problems using clever solutions that provide the ultimate flexibility. When he's not logged into Salesforce, Evan enjoys playing bass guitar in a local rock band.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: