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

learn more… | top users | synonyms

1
vote
0answers
11 views

Report user access level to accounts

I need to create a report showing all the accounts that a concrete user has access to (it's a similar issue like the reported on Generate report for Account User access?) I've tried to use the ...
0
votes
3answers
36 views

SOQL Query Question

I want to check the surname matching lastname and Pcode matching MailingPostalCode in the query of SOQL. public class ContactSearch { public static list<contact> searchForContacts(String ...
1
vote
1answer
19 views

Listing related data in custom email template via component

I am creating an email template which will be sent to individual contacts, the template needs to list rows from a related object. I have created the relevant component and class which I believe would ...
8
votes
0answers
50 views

When is SOQL Polymorphism going to be enabled by default?

SOQL Polymorphism (SELECT TYPEOF) was introduced in Winter 13, API version 26 for developer organization. Is this feature going to be enabled by default for production organizations also sometime in ...
-1
votes
1answer
38 views

Trouble constructing dynamic SOQL using LIKE expression - not getting results [on hold]

soql = 'select name, student_id__c, qualification__c, email__c from name__c where name LIKE :'+String.escapeSingleQuotes(studentName)+'%'; This query is not executing.
3
votes
1answer
41 views

How to query for formula fields in test classes

From what I understand, formula fields are calculated when a record is opened/read. If a record is created by a controller extension and then queried then it's never really opened or read, so ...
3
votes
1answer
45 views

Is there a smaller SOQL character data type then SQL Server-nvarchar for SF character fields?

(Warning: SSIS expert, SalesForce Noob) Hi all I'm working an SSIS package where the source is Salesforce.com and every character field is being interpreted by SSIS as a Unicode nvarchar, which is ...
0
votes
4answers
20 views

Get value of LookUp field through query

I am having a problem with a query. I am trying to extract the name of Assigned_To__c field (which is a look up field of Employee Rosters object). The query I have used for this is SELECT id, ...
3
votes
1answer
20 views

How can you aggregate a checkbox field with SOQL?

I need to get the average completion of a task which is recorded using a checkbox field. Since that is stored as TRUE and FALSE instead of 1 and 0 it's proving a bit difficult. I would have liked to ...
2
votes
2answers
79 views

Help with SOQL Query

I have a custom object Contract__c, which is in a relationship with Address__c. A Contract can have many Addresses, so Adress__c has a lookup field to Contract__c. I am trying to query all the ...
1
vote
1answer
14 views

Query Records “where MyCustom__Date__c.Month()=1”

I want the records where MyCustom_Date__c month is = January. Where my field MyCustom_Date__C is formula field lst="select Name from CustomObj__c where MyCustom__Date__c.month() = : 1" Its giving ...
0
votes
0answers
9 views

Count stamp in a field

I have a requirement where there are custom objects like Incident_abv__c , Incident_Transaction_abv__c (child of Incident) , Incident_Transaction_Line_Item_abv__c (child of Incident Transaction). Now ...
0
votes
1answer
29 views

Count number of child records using SOQL Aggregate

I am new to this and I hope someone can help me with this. What my aim is to count the number of AVTRRT__Job_Applicant__c records with a date value on Last_Activity__c field on ...
1
vote
2answers
48 views

Bind Variable Issue with SOQL Query in Test Class

I'll admit outright, I'm a beginner when it comes to Apex, so I apologize if anyone's addressed this already or if I'm missing something obvious, but: I'm trying to write a test class to cover my ...
1
vote
1answer
42 views

salesforce caching

I would like to know if salesforce has any type of caching services? Any type of service that would allow me to keep data across web requests and in memory ? I did some research and did not find ...
2
votes
1answer
78 views

Non-selective query against large object type (more than 100000 rows) - Contacts

I am running into a problem with an org that has a very large number of contacts. New contacts are created, or existing one are updated based on orders that come in via a REST interface. All was ...
0
votes
1answer
18 views

Can I return entire record set when using the Execute Anonymous Window in Dev Console?

This article: Is there a way to do Like against a list of Values?, has a nifty workaround for lack of a LEFT(Column, n) function. I am able to execute a successful code snippet in the anonymous window ...
2
votes
2answers
37 views

SQL 'where Exists' to SOQL query help

I am trying to identify any CASE records that have a email in custom field that matches personemail in account object. in sql I would write this something like this.. what is the corresponding soql ...
0
votes
0answers
15 views

How to use SOQL to query Account IDs that has 0 records of a custom related object?

I'm trying to write a trigger that would count upon insert/update the amount of "Active_Competitor_Relationship__c" records that's associated with each account record. The problem is that when an user ...
1
vote
1answer
17 views

SOQL query for displaying leadsouce type count by month

I'm trying to get the a query setup so it delivers the date for each lead in a format of just the month. Right the filter I have is working fine, but the CreatedDate format returns this rediculous ...
5
votes
0answers
28 views

SOQL Query by External ID is missing records

I'm having a problem consistently querying an object by an external id. When I do a SOQL query that has a queryplan that uses an index on the externalID, the record can not always be found. It is as ...
0
votes
2answers
31 views

Dynamic SOQL ERROR: invalid operator on id field

I'm facing this problem while creating this query. String qry = 'select name, id, account__c from orders__c '+' where account__c LIKE \'%'+searchText+'%\''; searchText is declared as public string ...
2
votes
1answer
27 views

Pagination with Wraper class List

I have Wraper class list which holds list of Records form 2 objects. This list Iam using in Page block table to show the data from both objects. Now I have to work on Pagination. For Pagination we ...
0
votes
0answers
13 views

Inconsistent behavior when retrieving fields in Apex Test Class

I've been experiencing a very strange issue I cannot explain when creating test coverage for my code. Typically I create all the hierarchy of objects that are involved in the test of a certain ...
0
votes
2answers
16 views

Query returning too many results

I'm trying to query based on serveral email address fields, but for some reason I am return ALL contact records in the org. I'm using several IN clauses, but I didn't think it would cause any issues. ...
2
votes
2answers
41 views

LastModifiedDate vs. SystemModstamp

According to SF's page on System Fields, SystemModstamp gets updated 'Date and time when this record was last modified by a user or by an automated process (such as a trigger). '. Does anyone have a ...
1
vote
1answer
23 views

SOQL Showing null values as 0

If a record is not found, can I have it show a 0, instead of not appearing in my results? For example: If I'm getting the total # of records for 5 different picklist values, and 1 picklist have has ...
3
votes
1answer
20 views

SOQL Query to show records for week

Basically I want to display records for a Monday through Sunday work-week, but depending on which day the query is run, the results should be consistent for that work week. Examples of what data I ...
1
vote
1answer
23 views

What is the best way to store and SOQL a junction sObject where multiple conditions need to be met?

Not sure of the best way to phrase that question, so it might be easier to describe my current solution and then explain why I am looking for a better one. So, I have an sObject called ...
0
votes
0answers
12 views

Track records update based on User entry

I have a requirement to show five sections with different SOQL querry records. Now one common field in all of them is an input text PICKLIST field. While doing update I want to track only those ...
1
vote
1answer
30 views

Need help on multilevel nested table

I am trying to display 2 level deep relation from parent to grandchild. Parent is order, child is order lines and grandchild is shipment lines. Order-->Orderlines-->Shipmentlines I am able to ...
-1
votes
2answers
41 views

Best way to query child, grandchild from parent

What is best way to display child, grandchild from parent or more than 1 level SOQL down. I tried to display grandchild of a parent record. Any reference would be great. Thanks
1
vote
1answer
30 views

No such relation 'Profile' on entity 'User'

I'm running the following SOQL query: SELECT Profile.Name, Title FROM User WHERE Id = '<some id>' Most of the times it works fine, but for some users I get the following error (I guess it's ...
3
votes
2answers
51 views

Adding SOQL Query to untested Apex Class causes errors in other classes

I have been asked to manage a large salesforce organization and I am getting a strange error. I simply need to create a Visualforce Page and a Controller right now. I have been banging my head against ...
-1
votes
3answers
34 views

Help with Removing SOQL from FOR Loop in Trigger

Need help moving a SOQL statement outside a FOR loop to prevent hitting limits. Scenario here is that there are two fields on our records, Quoted By User and Sold By User. Any time a record is updated ...
0
votes
1answer
24 views

Subquery returns parsing error

I am trying to fetch the currently logged in (customer portal) users details from their related contact field via SOQL. I have created what I believe is the correct SOQL statement however I am ...
1
vote
1answer
37 views

System.NullPointerException: Attempt to de-reference a null object

Error: Invalid Data. Review all error messages below to correct your data. Apex trigger InsertContact caused an unexpected exception, contact your administrator: InsertContact: execution of ...
3
votes
1answer
29 views

Can we change the date format in query?

SFDC always gives a format YYYY-MM-DD on querying the date field. Is there any function or some formatting I can put in the query to change the format of the date. ? Select somefunction (date__c) ...
0
votes
0answers
21 views

Visualforce Error - Dynamic SOQL Binding

I have queried Account record using dynamic SOQL <apex:PageBlockTable id="tableid" value="{!lstAccount}" var="acc"> <apex:repeat value="{!lstField}" var="f"> <apex:column ...
0
votes
0answers
11 views

using CMD data loader to find accounts whos ID is IN List/Array

I have a list of accounts that need to be updated but this list is not available in SF, this is only available in a remote Desktop environment. The accounts in this list do not have a SF ID; they do ...
0
votes
1answer
17 views

Unexpexted Token: 'A6tEZ'

I am getting this error, My query looks fine when I check it with Debug Logs - List<Account> lstAccount = new List<Account>(); String query = 'select ' + commaSepratedFields + ' ...
3
votes
1answer
48 views

SOQL injection in dynamic query

I am facing soql injection issue in my dynamic query, i have done with sting.escapesinglequotes() also but still facing this issue. here is my code. query: query = 'select id,Name,Owner.Id from ' + ...
1
vote
1answer
13 views

SOQL not displaying all the fields requested (relation fields)

I am not sure if I am missing something but I am doing the query below and for some reason it is not displaying in the result the relationship fields requested, while when I do it from the developer ...
0
votes
2answers
16 views

Contacts list in account object

I tried to use contacts list inside account object like this : Account a = new Account(); Contact c = new Contact(); c.lastName ='Test'; a.name ='Test'; a.contacts.add(c); insert a; The account ...
0
votes
1answer
35 views

I'm getting this error :'Data type not supported:Address , List<sobject> be displayed in VFpage

List<sObject> SObjectListToShow = Database.query(query); In Visual force page: <apex:page controller="SearchListController"> <apex:form > <apex:pageBlock ...
2
votes
0answers
25 views

Query Unbuilder class?

Does anyone know of query helper class like http://apex-commons.github.io/query/soql-builder/ that can deconstruct a query string? I'm looking for an apex class that can cut up a dynamic query ...
0
votes
1answer
14 views

Need to refer child objects records also in PDF

I have a requirement to display child object records also alongwith Parent records. Please find the below SOQL pattern. SELECT Name, Account_Abs_abv__c,Account_Location_abv__c,Attendee_Role_abv__c ...
1
vote
0answers
37 views

Nested Query error

I have below nested query where Line Item is child of Inc Transaction and all field names are valid still I am getting errored out Can someone please help me here? NESTED QUERY: select ...
4
votes
1answer
26 views

Solving Race conditions with ActionFunctions

I have had a big problem with race conditions in ActionFunctions corrupting my viewstate. When I call an AF to update one thing, and then click a button to do another, if the second finishes first, ...
2
votes
3answers
39 views

Salesforce large relationship (inner) query

I have a task to perform a fairly large and specific data removal. The goal is to remove all EmailMessage objects that have a parent Case record whose status is closed, from BEFORE a certain date. ...