Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionCalculateController - outputDecimalResult - Returns Integer instead of Decimal #1607

Open
systemsfixer opened this issue Nov 25, 2024 · 2 comments

Comments

@systemsfixer
Copy link

Overview:
Based on variable names I believe the decimal result should be a decimal, but it is actually an integer.

Steps to reproduce

Steps to reproduce the behavior:

  • Create a collection with a decimal field
  • Pass in the collection and decimal field into CollectionCalculateController
  • Observe the output is rounded to a whole number

Expected behavior

A decimal should be returned.

Actual behavior

An integer is returned.

@ericrsmith35
Copy link
Collaborator

I am unable to reproduce this behavior. Please provide more details and an example.

@systemsfixer
Copy link
Author

systemsfixer commented Dec 3, 2024

I have since modified the code in my orgs so a detailed reproduction would be difficult.

Basically I had:

  • A data table (standard flow data table)
  • A currency field in the table (multi-currency not enabled, corp. currency USD, currency field on sObject is 2 decimal points)
  • Using the dynamic collection processor to take the selected rows in and summing up the currency field
  • The output of the dynamic collection process was piped into a currency formula with 2 decimal points precision. This is the value that was showing as rounded to the nearest dollar

I essentially replaced the objToInteger in my org with

    // Convert an object to a Decimal
    private static Decimal objToDecimal(Object obj) {
        return obj == null ? null : Decimal.valueOf(String.valueOf(obj));
    }

and updated the test and now the same currency formula in flow shows non-rounded values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants