Where clause referencing multiple fields #456
-
I am currently building a flow to count the amount of a specific record utilizing a where clause, but I am having trouble excluding certain records I created a where clause to specify the type of records I want using fields on picklists, such as Record.Type = 'Solid', but I also need to exclude items based on color, so I added Record.Color = 'Green'. Upon putting them together I came up with the where clause This worked to only count records of a certain type, but it was as if the color portion was not even there. I have tried a bunch of iterations of "&&" and "AND" and even "OR" but nothing seemed to work. I even tried swapping the order of the two statements and it still only read the "Type". I am very new to SOQL so this may be a very simple fix, but through my own research I could not find anything that would work for me and that's why I am making this post. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
What is the API name of the Color field? Is it If Type is also a standard field (eg it needs no Try out your query in the Dev Console - you're basically looking to use the exact syntax that comes after the WHERE keyword |
Beta Was this translation helpful? Give feedback.
What is the API name of the Color field? Is it
Color__c
?RecordType
is a special field within Salesforce but you don't use dot notation in SOQL to reference fields (with the exception of relationship fields).If Type is also a standard field (eg it needs no
__c
notation for the API name), it's likely the correct where clause you're looking for isType = 'Solid' AND Color__c = 'Green'
.Try out your query in the Dev Console - you're basically looking to use the exact syntax that comes after the WHERE keyword