I want to count the number of child objects in a lookup (not master-detail) relationship. Since no rollup-summary (COUNT) fields are supported I thought I would do this:


Which fails with Error: Field $ObjectType.MyObj__c does not exist. Check spelling.

I'm guessing the real problem is that SF doesn't support GETRECORDIDS in formula fields but I would like to be wrong about this.

Any better ideas aside from triggers?

  • 1
    Looks like GETRECORDIDS is documented as being available only in custom buttons, links and scontrols. – ReidCarlberg Mar 5 '13 at 16:42
  • You are correct, it's weird how they don't have a page which shows you which functions are available in formula fields. – Marc Mar 5 '13 at 20:55

Well GETRECORDIDS are probably used in related list to get the ids of the selected records.

You can do the following:

  1. Trigger (that you don't want)
  2. Inline Visualforce page : If you just want to display the number of records to the user
| improve this answer | |
  • 1
    +1. Do not be tempted into making workflow that would add +1 to counter on parent on child insert (or change +1/-1 when child gets reparented) because it won't fire on delete. There's also a nightly batch job route if it doesn't have to be real time... – eyescream Mar 5 '13 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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