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

learn more… | top users | synonyms

8
votes
2answers
50 views

How do you dynamically select fields in for loop query?

Something has been bugging me for a little while now, and I can't seem to find the answer anywhere... When working with large queries, it is a good idea to use a for loop to iterate through the query ...
3
votes
1answer
50 views

Is there a way to do Like against a list of Values?

Is there a way to mix LIKE operator with IN ? Something Like SELECT Id FROM Account WHERE Name LIKE IN:nameList Where nameList is list of String? Is this is possible ? (I can make a dynamic query ...
2
votes
1answer
32 views

Linking tables for a report

I'd like to create a report that links two tables together. One is the Case table with some custom fields, Topic__c and Sub_Topic_c. I'd like to create another table that has the same two fields so ...
1
vote
0answers
28 views

Error selecting User.SmallProfileUrl from UserFeed query with SOQL

Hey guys I'm having an issue getting my first inner select working and just haven't gotten it to work no matter what I've tried. Does anyone see why I can't select User.Name, User.Email and ...
2
votes
1answer
37 views

Finding records where the latest activity is before X date

I'm building a script using the API so I can mass re-assign records with the following criteria. I need to find all leads that: a) Are owned by Person X b) were created before 9/1/2012 AND c) Either ...
1
vote
0answers
27 views

Any way to query CRM Content Subscriptions?

I was wondering if CRM Content subscription information is stored anywhere. I am trying to find which users are subscribed to a particular tag. This object is the only thing I have come up with as a ...
2
votes
1answer
64 views

Selection of group name and user name from GroupMember in one query

I'm used to using SQL to make queries from multiple tables in one query. What I'm trying to do is select all group members and their names where the group is of a type 'Queue'. I'm able to select the ...
1
vote
1answer
24 views

Using GROUP BY for the ChatterMessages SOBJECT

hey guys i'm trying to avoid nesting my query as such SELECT ( SELECT Body, CreatedBy.Name, CreatedBy.Email, CreatedBy.SmallPhotoUrl, ...
2
votes
1answer
30 views

Navigate Relationship soql

My objects are: CONTACT(lookup)-----ACCOUNT (master)-----ACCOUNT PLAN(detail/master)------INFLUENCER(detail) I want create a lookup on INFLUENCER that shows only the contacts related. With soql ...
6
votes
3answers
91 views

Field History Tracking - OldValue and NewValue null?

I turned on History tracking for a custom object and set it to work on a particular field. When I updated the field on the custom object, I checked to see if the corresponding __History object had ...
2
votes
1answer
50 views

Commandbutton Link to Visualforce Page Giving “SObject row was retrieved via SOQL without querying the requested field”

I have a strange Visualforce problem: a commandbutton throws a "SObject row was retrieved via SOQL without querying the requested field", but the same URL works as a straight-up link. Markup is ...
0
votes
1answer
30 views

How do we query and fetch all Comments of Salesforce CRM Content?

When we post a Comment on Salesforce CRM Content, where does the comments go? I want to fetch them via SOQL query, which object do they get saved in?
3
votes
1answer
33 views

How to replicate a “My Account Team and My Accounts” SOQL query?

When running a report and if Account Teams are enabled you have an option to search "My Account Team and My Accounts". This returns accounts in which you are listed on the sales team or you are the ...
0
votes
1answer
47 views

Trigger Testing Question

I've written a simple trigger that updates a field on child Contact records when a specific field in the parent Account record is modified. When I test it manually, it works beautifully! However, I'm ...
1
vote
3answers
36 views

Query records with their parent record name and their related records

I'm trying to query records with their parent record name and their related records. This is my query: SELECT Id, Name, Record_Type_Name__c, Engagement_Model__r.Name, (SELECT ...
3
votes
1answer
73 views

Returning an Auto-Increment value

I'm just curious, is there a method to access an auto-increment number in a newly inserted record without making another SOQL call? Something similar to how MySQL can call up the last insert ID after ...
2
votes
3answers
65 views

Map of API name and value pair..?

I want to create a map of apiname and value pair..please help... i want record value...like if apiname of opportunity field is name..then i want record value..ie opportunity name... for eg ...
1
vote
1answer
25 views

unable to query Case object

when trying to query case object with below SOQL, giving me an error that no such field exist. where as i can able to see field in the customization. ? is this permission issue ? select id,status ...
3
votes
1answer
30 views

Understanding Results of Querying ContentWorkspace

How is access or readabiity of a ContentWorkspace (library) determined? The following query is returning different results for me: select id, name from ContentWorkspace When logged in as a System ...
2
votes
2answers
57 views

Get Opportunity's Account

Question Why I can't access to opportunity account name on apex/vf ? Backgound I'm creating a opportunity VF page, extending the standarcontroller: <apex:page standardController="Opportunity" ...
1
vote
1answer
63 views

Use COUNT_DISTINCT(field) on REST SOQL API query

I'm currently trying to run the following SOQL query using the REST API: SELECT Id, accountId, COUNT_DISTINCT(accountId) FROM Contact WHERE Phone LIKE '%" + CLI + "' OR HomePhone LIKE '%" + CLI ...
0
votes
1answer
29 views

SOQL with OpportunityContactRole

I am trying to get all the role from OpportunityContactRole into a list my code OppContactRole = new List<OpportunityContactRole>(); OppContactRole = [SELECT Role FROM OpportunityContactRole]; ...
3
votes
1answer
34 views

Outbound Messaging: ActionId

I'm investigating the use of Outbound messaging for some integrations we need to make with SalesForce. According to the documentation, the outbound message includes an ActionId field which is a ...
3
votes
1answer
96 views

How to implement a generic DAO object for Service pattern with Apex?

Considering advice given for DAO objects or Service pattern from What is a good set of coding conventions for Salesforce development?, I'm wondering how can they be made generic enough? Some generic ...
4
votes
2answers
51 views

How does SOQL consider INCLUDES for multipicklist? AND or OR

i have multipicklist for industry. I have a records which has Bank,agriculture as the selected values. If i need to get all the records have bank and agriculture selected together. Would includes ...
5
votes
1answer
117 views

Can you use SOQL Date Literals in Apex?

Date Literals are really helpful in SOQL queries. There are times in Apex where it would be really helpful to be able to use the literals or some sort of easy equivalent (not in a SOQL query). Is ...
1
vote
1answer
78 views

query user and profile

I'm fairly new to salesforce so please bare with me as my understanding of the API' and SOQL is very limited. I'm having troubles linking user object and profile object through 1 query(), the correct ...
2
votes
2answers
74 views

Determine sobject Type From Id Using SOAP API

I'm using C# and would like to determine the type of an sObject based on it's id. I would like to pass an id to my app and have it return a list of accounts related to it. I need to identify the ...
0
votes
1answer
36 views

Need to find all TextAreas that have an unsual character

I have a long text area field which in some cases has characters that cause problems e.g. Vertical Tabs. I need to find all instances where the field contains such a character I can't write a SOQL ...
1
vote
2answers
63 views

SOQL query for text in the middle of text

Usually in SQL when you do a search on the lines of ... where blah like 'tony%' You can index blah column and then get a B Tree search. When you search for '%tony' You don't get a B tree ...
2
votes
3answers
124 views

What does the 'lkid' URL parameter mean?

What exactly is CF00NW0000000diSH_lkid a reference to, in this case? portfoliofunction = [ SELECT Id, Name, Subsidiaries_On_Contract__c FROM Contract_Overview__c WHERE ...
4
votes
2answers
87 views

How to export more than 50K records matching a query as a CSV?

I'm building a CSV exporter for use within a Customer Portal that allows them to export in bulk some of their data (basically usage logs, which there are a ton of). For some super users there are ...
2
votes
2answers
68 views

Avoiding casting with dynamic SOQL

According to this http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_soql.htm I should be able to avoid casting using dyanmic soql However when I try: opportunity = 'select ...
0
votes
1answer
39 views

Can I use a text field to create an Account object in a trigger?

I am adding an after insert trigger on lead, where if there is a value (id) in a custom field (fromAccount__c), that specific account with said id, will be deleted. this is in order to solve How to ...
2
votes
3answers
157 views

How to run SOQL for an Object having more than 100K records?

set<ID> conIDs = new set<Id>(); for (Time__c t : trigger.new) { if (t.Contact__c != null) conIDs.add(t.Contact__c); } if (!conIDs.isEmpty()) { for(Time__c t : [Select Id, ...
3
votes
2answers
67 views

Error: Field must be grouped or aggregated

We have a lookup relationship between a custom object Problem__c and cases, one problem can be related to many cases. I am trying to query the field or problem records and the number of related cases, ...
4
votes
2answers
87 views

Determine character length of formula fields prior to dynamic SOQL

My application constructs dynamic SOQL queries based on user interaction. The query can get quite large so I split the query into multiple queries based on the character count. However, formula ...
3
votes
1answer
41 views

where in syntax

I am looking for the where in syntax for raw soql. I try: SELECT ID, OWNDERID FROM Opportunity where OwnerID in {'005G0000002eMbxIAE'}; and SELECT ID, OWNDERID FROM Opportunity where OwnerID in ...
2
votes
2answers
67 views

Get Accounts with at least one attached object via SOQL

We have an object that relates to Account (Services). I'm trying to write a SOQL query that can give me accounts that have at least one active such object. Those objects have a checkbox that is ...
-1
votes
1answer
79 views

@future to reduce number of Soql Queries

Say Suppose I'm having 150 Records in a Custom object and I will display 100 records in a Vf page.When I select all the records and process then what happens is based on criteria,these fields will ...
6
votes
2answers
169 views

how to compare time only from Datetime field in SOQL

I have a custom Object which contains a Datetime field let say bookingDate It contains date and time of booking. now i need to get all bookings starts from 2:00 PM to 4:00 PM regardless of date ...
2
votes
2answers
100 views

Problem with EntitySubscription query and getting a Non-selective query exception

I have the following apex code that runs to get the EntitySubscriptions for a set of ids so they can be deleted to clean up the chatter feed. public static List<EntitySubscription> ...
2
votes
1answer
70 views

SOQL Query in Batch Apex start() times out even with multiple filter statements

In my SOQL query in my Apex Batch start() methods I query and order SELECT TextField__c FROM MasterDetailChildWith4MillionRecords__c WHERE Active__c = 'Yes' AND Revenue__c != 0 AND Lookup__c = ...
1
vote
1answer
92 views

Too many SOQL queries: 101 in apex class. How to count results?

List<tempcon1> listoftemp; CheckContactController chk = new CheckContactController(); public List<tempcon1> getconValues() { listoftemp = new List<tempcon1>(); for ...
3
votes
1answer
56 views

How can I filter activities by record type?

Issue How can I filter the ActivityHistories sub-query by record type? When I use record type in the query it's saying the field isn't valid. Background I'm doing a custom last activity date for a ...
0
votes
0answers
26 views

SOQL Selecting CollaborationGroups, GroupMembers and Posts/Comments?

Hey guys I'm trying to take a member, and select the group(s) the belong to, the (other) members in that group, and all posts and comments that are in that group. I have it set right now where I am ...
4
votes
2answers
57 views

Why are the results returned using a subquery different than when querying Tasks directly?

I am running the code below in a Task trigger. The subquery on Account returns 0 rows, but the direct Task query returns 1 row; there should be 1 row. Can someone explain why this could be ...
2
votes
1answer
383 views

Getting started on Apex - populate lookup field via SoQL

I am looking to use an Apex Class in a Visualforce page that populates a field based on the result of a SoQL query. The idea is that I am making a custom Save And Do X button which must be available ...
1
vote
2answers
73 views

SOQL Filter By First Letter

I have recently inherited a Visualforce page that lists all Accounts in a dropdown. As the company has grown, so has the list of accounts. Now that the account list has more than 1,000 entries and ...
1
vote
0answers
38 views

Error [sforce-2900000]: INVALID_FIELD: Can select only RecordId, a Has*Access field, and MaxAccessLevel

Running the below query returns and error message "Error [sforce-2900000]: INVALID_FIELD: Can select only RecordId, a Has*Access field, and MaxAccessLevel" SELECT RecordId, HasReadAccess, ...

1 2 3 4 5