I have a Lookup field on the Opportunity that looks up to the User called Cost Estimator. I would like to make it so the only users that can be selected are members of the Cost Estimator Public Group. Any thoughts?


1 Answer 1


Lookup filters can only filter fields on the related object. They can spider up multiple related records, but they can't do what you are looking for in terms of checking that user is in a public group.

So you would need a field to flag this on user itself in order to filter lookup.

Since you can't have triggers fire on public group membership, you could add some batch apex that would sync public group and user, if you want to go the public group route.

Custom fields on user object aren't pretty, but they can be helpful.

Alternatively, triggers could validate public group membership, but they only fire on save, so users could select anyone and wouldnt see the error until they save, so not great ux.

Adding one other option that came to mind. Hide the lookup field from the page layout. Add a formula field. If lookup is blank, formula displays "click to add cost estimator", else it displays cost estimator name.

The formula can link to a flow, or a visualforce page, that will let you filter by public group membership.

Visualforce will be better. Flow should work fine if you have a small number of group members, say less than 20. It could theoretically handle a hundred or so but I think the selection process would be ugly.

The vf page or the flow will set the lookup field, but the lookup won't be visible to user, just the formula field.

  • Create check box on user object and a filter condition on cost estimator lookup(filter criteria : cost estimator = true)
    – S B
    Sep 23, 2016 at 4:37
  • Glad to help. just added one other option that came to mind.
    – gorav
    Sep 23, 2016 at 15:12

You must log in to answer this question.

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