Questions tagged [where]

The syntax of the condition expression in a WHERE clause of a SOQL query includes one or more field expressions. You can specify multiple field expressions to a condition expression by using logical operators.

Filter by
Sorted by
Tagged with
1 vote
0 answers
314 views

How to get references of a standard field [closed]

I'm currently working on cleaning up the opportunity object and I'm facing an issue with getting the field references(Apex, Components, Workflow, Process Builder, Email templates, Reports) of complete ...
user avatar
  • 1,430
0 votes
1 answer
53 views

Query based on field equal to field in another query

I have a custom object that has for name a string that matches the BillingPostalCode field from different Accounts objects. I'm querying some accounts, and now I want to limit a query of this custom ...
user avatar
2 votes
1 answer
108 views

Is there a way to distinguish Long Text Area field or Rich Text Area field from a regular Text Area?

I need to build an interface to allow a user to filter record by the field chosen by the user. I know that I can use Text Area fields in the WHERE Clause but I can't use Long Text Area field or Rich ...
user avatar
  • 13.3k
0 votes
1 answer
57 views

Select related object based on priority field

I have two sobjects PriorityCase__c (Person__c(master-detail to Person__c), Priority__c) and Person__c (name). And I want to select Person__c with the highest Priority__c. The highest priority is 1. ...
user avatar
0 votes
1 answer
104 views

Query apex controller Where into a string

I am not a developer but I am trying to modify this controller that is available in a component I installed via app exchange. For what i understood the code is just converting this query into a string ...
user avatar
-2 votes
1 answer
268 views

Dynamic SOQL with multiple conditions and undefined amount of variables

I have SOQL like this: [SELECT id FROM CONTACT where lastName =:lastName AND firstName = :firstName] But what to do if there are only lastName variable? What if there are 3 variables or more? I ...
user avatar
0 votes
1 answer
82 views

How can I make a SOQL which selects Leads filtered by a Converted Account Field not being true?

We have a requirement, after leads are converted, we are sending data to a partner about them. We have a batch process which will periodically look for newly converted leads, send the data to the ...
user avatar
1 vote
1 answer
2k views

How to filter on CreatedDate using a date range in SOQL?

I'm having problems trying to filter a query by CreatedDate using a date range. The query returns always a wrong set of records. For example, if I want to get all records created until 2020-07-28, it ...
user avatar
1 vote
0 answers
174 views

Tooling API SOQL Where clause not working for certain fields

I'm working in the developer console using the tooling api to write a query against permission sets. This query works: select Name, Label, Description, ManageableState, NamespacePrefix, Type from ...
user avatar
0 votes
1 answer
2k views

How to pass set<id> dynamically to soql [duplicate]

I have a dynamic Soql in which I want to pass a set. I get an error: System.QueryException: expecting a colon, found '{' Anonymous window Set<Id> idSet = new Set<Id> (); idSet.add('...
user avatar
  • 2,090
4 votes
1 answer
99 views

SOQL Count of non-blank multi-select fields

I'm trying to find out how many people answered a multi-select question in a survey. For this count I do not need to know what they picked, simply that they picked something (or didn't not pick ...
user avatar
1 vote
2 answers
912 views

Unable to use Less-than/greater-than with Datetime in SOQL condition

I am unable to use a Datetime field in a SOQL query: SELECT Status FROM Campaign WHERE LastModifiedDate >= Last_Sync__c; I have a workaround where I create a checkbox formula field which is true ...
user avatar
0 votes
2 answers
827 views

Jsforce where clause having multiple conditions not working

This below code results in INVALID_FIELD: Test' AND ParentId = null AND EndDate > '2019-05-21' LIMIT 1 error.. How can I add more than one condition in where clasue? const a = 2019-01-03 const b = ...
user avatar
  • 137
7 votes
2 answers
5k views

SOQL: Populate a Literal List in WHERE IN Clause

I need to query for an object based on 2 string variables. The first one is a constant but the second one gets passed to the class constructor. So in the end I want to achieve something like this: ...
user avatar
  • 4,441
0 votes
2 answers
96 views

SOQL WHERE IN query

Which of these is better: object__c[] objects = [SELECT name FROM object__c WHERE opportunity__c IN (SELECT OpportunityId From OpportunityLineItem WHERE Product2.Family = 'My Item')]; or: ...
user avatar
  • 414
0 votes
1 answer
1k views

Datetime in WHERE clause

I am facing issue with Datetime column in WHERE clause. Below two queries are giving different counts. SELECT COUNT(CallTime_c) FROM SF...TableName WHERE CallDateTime > '09-13-2018 09:01:00' and ...
user avatar
  • 1
2 votes
3 answers
133 views

Check field's data availability in WHERE clause

Can we make a check on WHERE clause of a SOQL query for comparing 2 date fields availability? My requirement is, I want to get the response from query based on data availability on two different ...
user avatar
0 votes
3 answers
974 views

SOQL - Use the size of the list of inner child query in the WHERE clause

I was trying something like along those lines but it's not working: SELECT Id ( SELECT Id FROM Orders WHERE Custom_Field__c = '...
user avatar
  • 4,441