Skip to content

Reduce field size #150

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<caseSensitive>false</caseSensitive>
<description>Enter the name of the Apex Class which defines the action to be taken</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText>Enter the name of the Apex Class which defines the action to be taken</inlineHelpText>
<label>Apex Class Name</label>
<length>255</length>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<defaultValue>false</defaultValue>
<description>Set this to true to bypass this Trigger Action from being called</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText>Set this to true to bypass this Trigger Action from being called</inlineHelpText>
<label>Bypass Execution</label>
<type>Checkbox</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<fullName>Bypass_Permission__c</fullName>
<description>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified.</inlineHelpText>
<label>Bypass Permission</label>
<length>255</length>
<length>97</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Order__c</fullName>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<label>Order</label>
<precision>18</precision>
<precision>7</precision>
<required>true</required>
<scale>3</scale>
<type>Number</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<fullName>Required_Permission__c</fullName>
<description>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified.</inlineHelpText>
<label>Required Permission</label>
<length>255</length>
<length>97</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Enter the name of the sObject you want to have this action execute on during the after delete context</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the name of the sObject you want to have this action execute on during the after delete context</inlineHelpText>
<label>After Delete</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Enter the name of the sObject you want to have this action execute on during the after insert context</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the name of the sObject you want to have this action execute on during the after insert context</inlineHelpText>
<label>After Insert</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Enter the name of the sObject you want to have this action execute on during the after undelete context</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the name of the sObject you want to have this action execute on during the after undelete context</inlineHelpText>
<label>After Undelete</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Enter the name of the sObject you want to have this action execute on during the after update context</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the name of the sObject you want to have this action execute on during the after update context</inlineHelpText>
<label>After Update</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description
>Check this box to allow the flow to execute recursively</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Check this box to allow the flow to execute recursively</inlineHelpText>
<label>Allow Flow Recursion?</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Enter the name of the Apex Class which defines the action to be taken</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the name of the Apex Class which defines the action to be taken</inlineHelpText>
<label>Apex Class Name</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Enter the name of the sObject you want to have this action execute on during the before delete context</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the name of the sObject you want to have this action execute on during the before delete context</inlineHelpText>
<label>Before Delete</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Enter the name of the sObject you want to have this action execute on during the before insert context</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the name of the sObject you want to have this action execute on during the before insert context</inlineHelpText>
<label>Before Insert</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Enter the name of the sObject you want to have this action execute on during the before update context</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the name of the sObject you want to have this action execute on during the before update context</inlineHelpText>
<label>Before Update</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description
>Set this to true to bypass this Trigger Action from being called</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Set this to true to bypass this Trigger Action from being called</inlineHelpText>
<label>Bypass Execution</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<description
>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified.</inlineHelpText>
<label>Bypass Permission</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Description__c</fullName>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<label>Description</label>
<length>32768</length>
<type>LongTextArea</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<description
>Enter the API name of the flow you would like to execute.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the API name of the flow you would like to execute.</inlineHelpText>
<label>Flow Name</label>
<length>255</length>
<length>97</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Order__c</fullName>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<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.

Copy link

Choose a reason for hiding this comment

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

Since every record is 2k of storage space the way Salesforce measures it, how does this change make a meaningful difference in anything?

Copy link
Author

Choose a reason for hiding this comment

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

@dschach Because this is not an SObject record, it is a custom metadata type. For Custom Metadata types, every character DOES matter and does change the used storage against the 10MB global limit.

https://help.salesforce.com/s/articleView?id=platform.custommetadatatypes_limits.htm&type=5

Relavent note:

Record size is based on the maximum field size of each field type, not the actual storage that’s used in each field. When adding fields to a custom metadata record, use the appropriate type and specify a length that doesn’t exceed what’s needed for your data. This action helps you avoid reaching the cached data maximum. For example, if you create a US social security number (SSN) field, select the Text data type, and specify a length of 9. If you select Text Area, the field adds 255 characters to the usage count for each record, regardless of the number of characters entered.

Copy link

Choose a reason for hiding this comment

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

I learned something; thank you. So the savings of 12 characters with an org limit of 10,000,000 is something that would be significant?
(That's obviously tongue in cheek because I do agree that every optimization should be considered.)
There is a chance here, though, that an org went for ridiculously-spaced values here and those will be cut off. Mitch may have made a decision in version 1 that we can't undo, no matter how much we may want to.

<precision>7</precision>
<required>true</required>
<scale>3</scale>
<type>Number</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<description
>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified.</inlineHelpText>
<label>Required Permission</label>
<length>255</length>
<length>97</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description
>Set this to true to bypass all Trigger Actions from being called on this sObject</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Set this to true to bypass all Trigger Actions from being called on this sObject</inlineHelpText>
<label>Bypass Execution</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<description
>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified.</inlineHelpText>
<label>Bypass Permission</label>
<length>255</length>
<length>97</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<description
>Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix.</inlineHelpText>
<label>Object API Name</label>
<length>255</length>
<length>40</length>
<required>true</required>
<type>Text</type>
<unique>false</unique>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<fullName>Object_Namespace__c</fullName>
<description>Enter the namespace object for this trigger.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Enter the namespace object for this trigger.</inlineHelpText>
<label>Object Namespace</label>
<length>255</length>
<length>15</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<description
>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified.</description>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<fieldManageability>SubscriberControlled</fieldManageability>
<inlineHelpText
>Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified.</inlineHelpText>
<label>Required Permission</label>
<length>255</length>
<length>97</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
Expand Down