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
robert.bruski1.3887740572350007E12robert.bruski1.3887740572350007E12 

update field

Hello,

I'd like to roll up summary a field that is currently a formula. However, i'm under the understanding that this isn't possible natively through salesforce at the moment.
So i figured i'd just copy the field that is a formula into a new field where it isn't a formula and roll that up. I think this will work... however it's the copying/field update that i'm having an issue with.
It seems as though field updates can only be done with workflows that are triggered when a record is created or edited. i'm not looking for it to be live. it at least have it updated whenever a different field (in the same object or not) doesn't equal 0.
How can i do this? Apex?

Robert
Venkat PolisettiVenkat Polisetti
You can certainly do a rollup summary from the master if the child object's formula field is a proper type for the summary.

For testing purposes, I tried on the Account and Opportunity objects. Here is what I have.

Opportunity -> Fiscal day for Close Date --- This is a formula field that is of type number.
Account -> Fiscal Days total for all opps ---- This is a roll-up summary field on Account that is rolling up the Opportunity's formula field.

See the screen shots below:

Formula Field Definition

Roll-up Summary field

Hiope this helps,
Thanks,
Venkat

robert.bruski1.3887740572350007E12robert.bruski1.3887740572350007E12
Hmmm.. yeah that isn't working for me. When i try to go the master and create a new rollup field, the childs fields doesn't display. and this because it is a formula field it'self (quantitiy x price). However when i creat a new field and create a workflow and field update and have the formula field copied into the new field, i'm able to roll up that field and summarize it. The only problem is that this new field will only be updated with it is edite, but i want ti to be updated on a live basis... because one of the inputs into the formula (price) will be updated daily.
Venkat PolisettiVenkat Polisetti
Are you sure you have a master detail relationship between those objects? 
Are they standard object?
Can you post the names of the objects?

crop1645crop1645
Robert 

You are correct that workflows won't fire unless the record is updated/created. However, there is a clever workaround suggested here: https://success.salesforce.com/ideaview?id=08730000000BrIGAA0 for your use case.

The Apex solution would be to use a Apex Scheduled Job that forces a clone of your child's formula field to a number field and hence the RSF would work for you.  You could have the job run once a day or hourly or any other schedule supported by the System.Schedule CronExpression
robert.bruski1.3887740572350007E12robert.bruski1.3887740572350007E12
Venkat, 
Yes i'm positive i have a master-detail relationship.
They are both customs objects.
The master object that will have the rollup summary field is called Portfolio__c
and the child object that contains the field that will be rolled up is called: Holding__c and the field that will be rolled up is called: Market_Value__c and it is made up of a formula that is: Units__c * Investment__r.Price__c
Robert
robert.bruski1.3887740572350007E12robert.bruski1.3887740572350007E12
Crop1645,
i've read the link you sent and that is quite interesting. which way would you recommend?
note that i will be embedding this into an app that will be on the app exchange so it should be something that is compliant with that.
i was originally trying to create the cloning method... however i'm not sure how to create the apex scheduled job and was hoping someone could lend a hand.
Robert
robert.bruski1.3887740572350007E12robert.bruski1.3887740572350007E12
Note: i've also tried to set up those multiple workflows that are timed for every hour.. but it doesn't seem to be working