Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Is there a way via code to do what this button does?

enter image description here

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Let me say first that forcing RSF recalculations incurs a performance hit. You shouldn't need to do it programmatically.

That said, each of these actions will trigger a recalc. I believe you can do each of these through MD API (it's not Apex though, I know). Source: https://help.salesforce.com/HTViewHelpDoc?id=fields_about_roll_up_summary_fields.htm&language=en_US

  • Changing the roll-up summary definition (such as the object, function, or field being aggregated)

  • Changing the expression of a formula field referenced in a roll-up summary field

  • Replacing picklist values for picklist fields referenced in the roll-up summary filter

  • Changing picklist record type definitions

  • Changing currency conversion rates

  • Changing price book entries

(But if you have a reproducible case where you can predict you'll need a forced recalc, I'd very much like to hear about it.)

share|improve this answer
    
My other question I created explains it: salesforce.stackexchange.com/questions/46061/… –  dphil Aug 5 at 19:35
    
I assume you meant this one: salesforce.stackexchange.com/questions/46037/…. Hmm, I wonder if DBAmp is doing something other than a plain insert. If I were you I'd file a case with them, if possible. –  Carolyn Grabill Aug 5 at 21:17
    
O yea that one. We tried that and they don't really know whats going on and didn't give any good ideas to work around it. –  dphil Aug 5 at 22:58

I believe updating any child record should kick of the asynchronous recalculation of the roll-up summary.

share|improve this answer
    
but would that be for all records or just the parent record of that child? –  Jagular Aug 5 at 18:47
    
Updating any child record should do it. SF might do a ISCHANGED(field_to_be_rolled_up__c) check though. –  AmatorVitae Aug 5 at 18:59
    
Yes, unfortionately it's not. The issue seems to be when new children are created though. –  dphil Aug 5 at 19:34
    
Try a test: update a parent then update a child and see if anything goes –  AmatorVitae Aug 5 at 19:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.