function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Keenan WojniczKeenan Wojnicz 

Custom field automation not updating correctly?

Hello,

I have a custom field called "Total MRR".
The field is an automaticall calculated Roll-Up Summary type field that summarizes Opportunity Product.
When you enter a product in my Salesforce instance you are prompted to enter a term (months) for the product.
I have a workflow rule that triggers a field update when "Product: Product FamilyEQUALSSubscriptions Cloud,Subscriptions On Premises".
The field update updates an opportunity product field called "MRR" with the following formula: (UnitPrice / Terms_Months__c) * Quantity

Now the question: 
If I have a product with a term of 36 months, and a product with a term of 1 month, the "Total MRR" field on the opportunity page is not updating properly. 
I believe it is because Salesforce is creating a common denominator for the two different terms. Can anyone help me with this problem? 
Best Answer chosen by Keenan Wojnicz
Abhishek BansalAbhishek Bansal
Hi Keenan,

Salesforce has provided Rollup summary fields so that we can perform basic calculations like addition, substraction etc on child records and store the information in parent.
So in your case also the Total MRR field is simply adding the values for MRR field on Product.
If you think that you are not getting the required result than you must change your formula for MRR field on Product so that it can return the required result and finallly your Total MRR field will also show the desired values.
if you think that Total MRR field is holding correct values and still needs something to be done on Total MRR field than instead of using Rolll Up field you should use Trigger and than calculate values for this field accordingly.

Please let me know if you need more information on this or if you need any further help on this.

Thanks,
Abhishek Bansal.