SFDO-Community / declarative-lookup-rollup-summaries

Declarative Lookup Rollup Summaries (DLRS) is a community built and maintained Salesforce application that allows you to create cross object roll-ups declaratively - no code! For install instructions and documentation, visit our website https://sfdo-community-sprints.github.io/DLRS-Documentation/
https://sfdo-community-sprints.github.io/DLRS-Documentation/
BSD 3-Clause "New" or "Revised" License
696 stars 238 forks source link

Multiple criteria in one rollup? #41

Closed CapstoneLogistics closed 10 years ago

CapstoneLogistics commented 10 years ago

Is there a way to have multiple criteria for a rollup? I want to pull opportunities that are won and are of a certain Record Type.

wes1278 commented 10 years ago

@AndrewHess,

Yes, you can write any where clause that's valid into the tool. For instance, the following criteria would be valid: StageName='Closed Won' AND RecordTypeId= 'XXXXXXXXXXXXXXXX' You would need to include StageName and RecordTypeId in the fields list.

I'm willing to bet that relational queries would work as well, but I can't say for certain. An example of that might be: StageName='Closed Won' AND RecordType.DeveloperName = 'myRecordTypeName' You would need to include StageName and RecordType.DeveloperName in the fields list.

A good way to play around with how to create multiple criteria is to use the Query tool in the Workbench (https://workbench.developerforce.com/query.php). You'll see a section called "Filter results by:" where you can create some conditions and see the WHERE clause that's generated from that.

Let me know if you need some more help.

-Wes

afawcett commented 10 years ago

@wes1278 Thanks for picking this one up, spot on! :+1:

afawcett commented 10 years ago

@AndrewHess Hope this helped, i'll close out the issue for now, please simply add a new comment on this issue if not and we can re-open and help you further. Good lick! :+1:

egagnier commented 9 years ago

Hi,

The AND operator works great. But What about the OR? It doesn't works for me (error is 'unexpected token: or').

Thank you for your help.

aheber commented 9 years ago

See #138

egagnier commented 9 years ago

Hi,

Thank you aheber but ...

I tried this criteria in Relationship Citeria field : SELECT Nom_session__c FROM Participation_animationc WHERE Presencec = 'Réalisé' or Presence__c = 'Prévu' I tested it with Worbench. It works.

I get this error : Error: Relationship Criteria 'SELECT Nom_session__c FROM Participation_animationc WHERE (Presencec = 'Réalisé' or Presence__c = 'Prévu')' is not valid, see SOQL documentation http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_select_conditionexpression.htm, error is 'unexpected token: 'SELECT''

I haven't any error when I only use (Presencec = 'Réalisé' or Presencec = 'Prévu') but only 'Prévu' is counted

Thank you for your help

egagnier commented 9 years ago

It works !

I needed to remove the Trigger, write my criteria (Presencec = 'Prévu' or Presencec = 'Réalisé' or Presence__c = null) and deploy again the Trigger.

Thanks a lot. Have a good day :)