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

Reduce field size #150

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

yippie
Copy link

@yippie yippie commented Jun 27, 2024

Custom Metadata Types have a small (10Mb) limit for the total amount you can store in the records. Storage usage is determined by a fixed per record size that is affected by the field size.

Current field size is set to the max for all field types. However, several fields reference API names which have documented max lengths they can be in Salesforce. Any field size greater than this is "wasted" storage as it will never be needed.

Changes

  • Reduced fields referencing Salesforce APIs to the maximum allowed API Name length for the type

  • Updated fieldManagability to SubscriberControlled so that the framework could be included in a managed package.

  • Tests pass

  • Appropriate changes to README are included in PR

@mitchspano
Copy link
Owner

Please sign the CLA so I can review these contributions.

https://github.com/mitchspano/apex-trigger-actions-framework/blob/main/docs/contributing.md

<label>Order</label>
<precision>18</precision>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? This field is used in the framework's logic and is not related to an API name with limited length.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right there is not a specific or hard limit here. However, the goal is to reduce storage size and reducing precision DOES make each record take up less space. I would argue that a precision of 18 is excessively large. No one will ever need to be able to order 100 trillion trigger actions (x1000 decimal places). I am proposing cutting storage space by 1/3 and limiting to 9999 actions without using decimals or 1 million if using the 2 decimals also. This should still leave plenty of breathing room to make your order values every 10 or even 100 to leave space in between for future actions.

<required>true</required>
<scale>3</scale>
<scale>2</scale>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will truncate data for anyone who is already using all 3 decimal places.

Let's keep it at 3.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<required>true</required>
<scale>3</scale>
<scale>2</scale>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will truncate data for anyone who is already using all 3 decimal places.

Let's keep it at 3.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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

Successfully merging this pull request may close these issues.

3 participants