2

I have a formula field that is rolled up in a parent object.

The field is of this form i.e. constants for the case values:

        <formula>IF (
            ISPICKVAL(Status__c , &quot;Complete&quot;),
            CASE(Type__c,
                &quot;Abc&quot;, Amount__c,
                &quot;Def&quot;, Amount__c,
                &quot;Ghi&quot;, Amount__c,
                &quot;Jkl&quot;, Amount__c,
                null
            ),
            null
        )</formula>

My goal is to make those constants configurable so I created a Custom Metadata Type and referenced the values from that:

        <formula>IF (
            ISPICKVAL(Status__c , &quot;Complete&quot;),
            CASE(
                TEXT(Type__c),
                $CustomMetadata.Set__mdt.Types.Value01__c, Amount__c,
                $CustomMetadata.Set__mdt.Types.Value02__c, Amount__c,
                $CustomMetadata.Set__mdt.Types.Value03__c, Amount__c,
                $CustomMetadata.Set__mdt.Types.Value04__c, Amount__c,
                null
            ),
            null
        )</formula>

but got this error when pushing using sfdx:

Unable to use this formula containing derived values because the field is included in the following roll-up summary field(s): Parent.Total. To continue, remove references to derived values such as current date, current user, or user-role.

Any way out of this e.g. some other pattern to do the configuration (of a managed package)?

(Yes a change of the CMDT record would impact the rollup value, but for my case this is a once-off configuration so the values amount to constants. But yeah I kinda get it.)

1 Answer 1

0

I've added a new "Category" field where a before trigger reads the CMDT records and stores a value in the record that the formula fields then reference. This eliminates any values derived on the fly from the formula; it's now just another field on the same record being referenced.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .