Questions tagged [soql]

Salesforce Object Query Language (SOQL), modeled on SQL, for accessing information saved in the Salesforce database.

Filter by
Sorted by
Tagged with
8 votes
2 answers
724 views

Query Chatter Comment Files for a group of records

My question is similar to this one except that I need the files for a group of records, making the solution of querying ContentDocumentLink unworkable, because it requires a single Id for the where ...
Daniel Blackhall's user avatar
1 vote
2 answers
67 views

Query for what's not found

I have a parsed csv where I need to match on two columns: for (integer i=1; i<lines.size()+1; i++){ try{ PremiseNumbers.add(lines[i][Pindexnumber]); ...
Shane McLaughlin's user avatar
2 votes
3 answers
4k views

How do I convert a method to Batch Apex?

hoping I can get some help with Batch Apex as I have zero experience with it and the docs aren't all that good. I have a class that does the following: 1. Constructs a Set of Account Ids 2. ...
Davin Casey's user avatar
  • 4,207
3 votes
2 answers
2k views

MALFORMED_SEARCH error with SOQL query in C# application

when I run this SOQL query via the Developer Console it works... SELECT Id FROM Event WHERE Subject LIKE 'Order%Created' or SELECT Id FROM Event WHERE (Subject LIKE 'Order%Created') But when I put ...
James Colyer's user avatar
4 votes
2 answers
2k views

Apply List Views to large pagination sets

I want to apply a list view to a standard set controller (only way to apply is a list view is the standard set controller) If the my query returns the maximum number of rows in a SOQL query: 10000 ...
jordan.baucke's user avatar
4 votes
1 answer
6k views

Is it possible to combine these aggregate SOQL queries?

I'm using a few aggregate SOQL queries to mimic a rollup summary on an object that I don't necessarily want in a master-detail relationship. They are part of a trigger that fires when one of the ...
Scott McClung's user avatar
1 vote
2 answers
1k views

Is the OwnerId field in the Report object a polymorphic key or not?

Is the OwnerId field in the Report object a polymorphic key or not? So the OwnerId field in the Report object can be either a reference to a Folder, Account, or User, doesn't this make it a ...
fourq's user avatar
  • 2,091
7 votes
2 answers
1k views

Is SOQL Polymorphism enabled by default in API 26?

Is SOQL Polymorphism enabled by default in API 26? I'm getting the error 'SOQL TYPEOF expressions are not supported in this organization' error when deploying to my test org that's on API 26.
fourq's user avatar
  • 2,091
50 votes
7 answers
44k views

Obtaining all ContentDocument records using SOQL

According to the Salesforce documentation on ContentDocument Users (including users with the “View All Data” permission) can only query files they have access I find this very strange. Why would a ...
GuiSim's user avatar
  • 922
2 votes
3 answers
1k views

SOQL Polymorphism Results

What kind of result set is returned from this SOQL and can I write this inside a for loop? [SELECT Name, Description, TYPEOF OwnerId WHEN Folder THEN Name END FROM Report]
fourq's user avatar
  • 2,091
1 vote
1 answer
778 views

Query Chatter as part of nested query on a custom object

Currently I have code that uses apex:repeat to push out nested data from a custom object and I need to add the chatter for the ParentObject to the output. I've been trying to find a way to do this by ...
Matthew Whittemore's user avatar
2 votes
1 answer
2k views

Migrating attachments from one org. to another

hoping someone can help me with this issue. We have a requirement to migrate all .pdf attachments (purchase orders) from the Contract object in our current SFDC org. to the Account object in our new ...
Davin Casey's user avatar
  • 4,207
0 votes
3 answers
7k views

GROUP BY Clause SOQL

How do I create a SOQL GROUP BY using custom field? For example: SELECT id, name, Cultura__c FROM SC_VPM__c GROUP BY Cultura__c This returns an error: MALFORMED_QUERY.
Guilherme Gobetti's user avatar
2 votes
1 answer
470 views

Bug in force.com explorer

Can anyone check and let me know if the same thing happens for you? A bug in force.com explorer Adding a subquery in the SELECT portion before FROM reduces the number of records returned. Also if I ...
Sathya's user avatar
  • 3,182
3 votes
3 answers
2k views

Unable to select CaseComment CreatorName field

I am wanting to select the CaseComment CreatorName field as a part of a custom CaseComments VF page: [SELECT Id, CommentBody, CreatorName FROM CaseComment ...
Joe's user avatar
  • 3,413
3 votes
2 answers
1k views

What are the limitations on using a semi-join in a batch apex query locator?

I have a relativley complex batch apex process that needs to pull in a large number of master objects based on a field on the master OR the detail object. However in my apex logic I need to ensure ...
ca_peterson's user avatar
  • 22.7k
5 votes
2 answers
3k views

Why is Task ActivityDate (Due Date) different when queried using SOQL?

When I query a Task's ActivityDate in Apex accessed using JavaScript Remoting, I receive a date that is different from the date displayed in the Salesforce interface. The query below (with a generic ...
Matt K's user avatar
  • 3,380
8 votes
1 answer
2k views

SOQL query on fields related by polymorphic lookups

Here is the SOQL query I am trying to make: List<Task> tasks = [ SELECT Id,ActivityDate,Status,Subject FROM Task WHERE What.Type = 'nexus__Goal__c' AND (What....
zachelrath's user avatar
  • 9,503
1 vote
2 answers
2k views

Split a single field into 2 columns for a VF page

I have the following custom object: *Object* Revenue__c *Fields* Date__c, Type__c, Amount__c Where Type__c is a picklist and can be 'Budget' or 'Actual'. I'm trying to display this in a VF page ...
Nick Cook's user avatar
  • 6,084
3 votes
4 answers
3k views

Non-selective query against large object type in trigger

The Alert__c object has a Rule ID field, which is just text, and a lookup to the Master__c object. I have a trigger on Alert__c, which when runs after insert, update or delete. It collects the Master ...
Jeremy Nottingham's user avatar
0 votes
2 answers
174 views

Get the count of no of booking made by contact for given date and for next seven days after given date

I have a custom object called booking which has alll the bookings made by contacts. I need to have a VF page to get all the bookings made by all the contacts with a specific recordtype and show the no ...
Prady's user avatar
  • 12.1k
13 votes
1 answer
16k views

How do I query custom object history in SOQL with an inner query?

I'm trying to pull the history records of a custom object with an inner query. Here is the sample: Select Id, Name, (Select NewValue From Custom_Object__History) From Custom_Object__c Based on the ...
Jonathan Jenkins's user avatar
18 votes
4 answers
48k views

Field can not be filtered in SOQL query call

Here is my SOQL code for finding records to update but it is generating a compiler error like "field 'Chatter_Monitor_Policy_Keyword__c' can not be filtered in query call". Why can't I filter by this ...
Kishan Trambadiya's user avatar
6 votes
2 answers
7k views

Semi join sub-selects are not allowed with the 'OR' operator

This error is killing me :( Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions (or) Semi join sub-selects are not allowed with the 'OR' ...
Sathya's user avatar
  • 3,182
2 votes
2 answers
2k views

Custom button to delete some tasks

I'm trying to create a custom button which deletes a list of Tasks, depending on certain criteria. Here's my custom button code: {!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} {!REQUIRESCRIPT("/...
Davin Casey's user avatar
  • 4,207
6 votes
2 answers
478 views

Querying Chatter tags

Is it possible to query Chatter tags via APEX? For e.g. if I'd like to know the tags associated with an Account record, can I query them using SOQL? Anup
Anup's user avatar
  • 3,760
17 votes
4 answers
6k views

SOQL - query a query

We're in the process of converting an Access DB to Salesforce, a lot of our reports are built from querys of querys. For example, we want to produce a report that shows some fields from the parent ...
paul's user avatar
  • 1,492
5 votes
1 answer
222 views

Determine org. wide security on an object

I'm trying to determine (in APEX) what the security level is of a custom sObject (for a UI) For example: mysObject__c (Public Read Only, Private, etc.) I know it's possible to test the by inserting ...
jordan.baucke's user avatar
10 votes
1 answer
2k views

Time limit exceeded and 'Response size exceeded 30MB organization limit' and Semi-join subselects not allowed

Am getting a time limit exceeded error when am trying to pull a set of records through database.getquerylocator and binding it to vf page (jqgrid). I have about 80000 records but am limiting it to ...
Sathya's user avatar
  • 3,182
7 votes
1 answer
15k views

Is there a way to Query Role Hierarchy?

Using the Web-Services SOAP API, I'd like to query for all UserRoles under the same Parent Role. The only way I can think of doing this is by querying all Roles, then putting together a tree using ...
Matt K's user avatar
  • 3,380
14 votes
6 answers
8k views

Why is the count() query in salesforce not counting the no. of query rows returned as 1?

Sample code on a custom object, Asset__c, containing 78,000 rows: Integer number1 = [SELECT count() FROM Asset__c ]; system.debug('Query Rows used by count():'+Limits.getQueryRows()); If i do this.....
Sathya's user avatar
  • 3,182
10 votes
2 answers
14k views

Can you use the LIKE operator in SOQL queries via the REST API?

As the title states, can you use LIKE in SQOL queries via the REST API? Even with this basic query: select Id from Account where BillingState like 'VIC%' I'm getting an error back: REST ...
Matt Lacey's user avatar
  • 25.1k
13 votes
4 answers
19k views

How to query more than 50000 records in apex and bind it in vf page in jqgrid and paging?

How to query more than 50000 records (78000 records) in apex and bind it in vf page in jqgrid and implement paging in it? I tried querying through SOQL and assigning it to list.. Am unable to query ...
Sathya's user avatar
  • 3,182
3 votes
2 answers
3k views

SOQL - "Expecting right square bracket, found 'OR' "

I am attempting the following query but I seem to be missing something obvious: //Gets a list of the contact Ids which dont have a classification type or dont have a specified type List<...
Jim's user avatar
  • 1,116
6 votes
2 answers
6k views

Retrieving custom fields from a standard controller in an extension

How do I retrieve custom fields from a standard controller in a Visualforce extension controller? In the code below, if I remove the hard-coded ID "this.personParentId = '001Z000000CkZ4m';", it fails ...
ModestCowboyDan's user avatar
10 votes
3 answers
5k views

Optimal way to get Case.Id from Case.Thread_Id

We've implemented a custom Apex Email Service to extend the standard Email-to-Case functionality, and one area we're struggling to do efficiently is figure out the CaseId when all that is known is the ...
Mikey's user avatar
  • 2,958
11 votes
4 answers
13k views

How to query all Chatter Files attached to a record?

We're trying to build a custom Visualforce related list that will show all the Chatter Files that are related to a record. All files should be displayed, regardless of if they are explicitly shared ...
Matthew Lamb's user avatar
12 votes
4 answers
20k views

Is there a maximum value for LIMIT in a SOQL query?

I have 535 Contact records in my Developer account. I am finding that the following query: SELECT Id,FirstName,Lastname FROM Contact LIMIT 205 OFFSET 190 returns 200 records from Database.query(), ...
Jeff Trull's user avatar
56 votes
6 answers
31k views

Can report data be accessed programatically?

Is there any way to access existing reports and their data to be used in apex? Sure, I could write the SOQL manually but if I want it to mirror a specific report I would have to make code changes ...
Ryan Elkins's user avatar
  • 7,607
10 votes
2 answers
1k views

Unit test SOQL limit setting up data model

I have run in to this situation where the data model is very complex and since SF doesn't support mocks (e.g., Mockito) there are so many SOQL executions in just setting up the data model (triggers, ...
Peter Knolle's user avatar
  • 28.9k
7 votes
6 answers
3k views

Clone SObject Relationships

Is it possible to use a database query to get a set of related records and clone them into new related records. sObject[] sObjectsWithChildRelationships = [SELECT Id, (SELECT Id, myObject__c FROM ...
jordan.baucke's user avatar
4 votes
2 answers
15k views

how can we know if an email sent from salesforce is actually sent?

i have an workflow setup to send an email alert. For some reason some emails are not received by the contacts. Is there a way we could identify if the emails were sent or not successfully. I have a ...
Prady's user avatar
  • 12.1k
39 votes
3 answers
49k views

What standard and custom fields are indexed?

I'm trying to find a proper list of what standard fields are indexed by default in salesforce, as well as under what conditions custom fields are indexed. To start things off I know fields are ...
ca_peterson's user avatar
  • 22.7k
9 votes
3 answers
3k views

Querying Delegated Administrators

Is there a way to query a list of delegated administrators? I looked in the list of objects available to query in Force.com Explorer and can't find any objects that look like they would have this ...
Daniel Hoechst's user avatar
2 votes
2 answers
752 views

Why do Queries on Tasks not return records when multi-connect is enabled?

I have a visualforce page and controller in a development org with multi-connect to tasks (shared activities) enabled. If I query a task with multiple connected contacts through that page it returns 0 ...
Greg Grinberg's user avatar
11 votes
1 answer
2k views

How to do a multi-level relationship query on Chatter/Comments

Trying to perform a SOQL query to retrieve related FeedItems and FeedComments (on the related FeedItems) to my sObject and I retrieved a warning that multi-level queries aren't allowed. Can anyone ...
jordan.baucke's user avatar

1
112 113 114 115
116