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

learn more… | top users | synonyms

-1
votes
1answer
25 views

ANSWERED: SOQL Returned Sets Inside Of Cells - Not Sure What To Do Next With Apex

I am working with 3 SalesForce objects: Enrollment_New__c, Application_Checklist__c, and Opportunity. Application_Checklist__c and Opportunity are both in a "child" relationship to the parent ...
1
vote
1answer
30 views

SOQL query returning empty list

I'm trying to query for a custom object. In the query editor in the Developer console, this query returns 1 row. SELECT Id, Name FROM Household_Served__c LIMIT 1000 But then when I code it in ...
0
votes
2answers
34 views

Trigger checkbox when Insert/Update

I would like to update the checkbox field 'New' to false when there's a new record inserted or updated when the colID is more than the previous colID. For instance: My record as shown: ProdID = 1 ...
0
votes
2answers
33 views

Trigger after insert, before update

Im trying to create a Trigger on my Products. Would like to update the New checkbox field to false if the col is more than the newly inserted col and if the checkbox field is true. However the trigger ...
1
vote
3answers
38 views

Display distinct record in Visualforce

APEX CONTROLLER: productInvList = new list<ProductInventory__c> (); inv =[Select ProductID__r.Name,ProductID__r.Launch__c, ProductID__r.ProductID__c, ProductID__r.More_Colors__c, ...
2
votes
2answers
43 views

SOQL to get all Leads that were created on particular date or range

I am trying to a REST call from java and trying to query LEAD entity to get all Leads that were created on a particular date/date range. I am unable to get working query for the same. I am doing ...
0
votes
1answer
33 views

How to retrieve records from two objects which has lookup relationship?

I have Custom object DriverEfficiency__c which has (contact(lookup),Car_Meter_Reading__c,Efficiency_Rating__c,Fuel_Liter__c) fields. The Problem is I need to create a Vf Page to retrieve records from ...
0
votes
1answer
27 views

Convert trigger to apex class

I have two custom objects. The first stores transactional data with a externally generated customer ID. The second custom object maps this customer ID to a salesforce account ID. I'm trying to find ...
1
vote
1answer
17 views

List controllers are not supported for Order Item

I am trying to create a custom EDIT ALL list button on OrderItem (Order Product) with content source as Visualforce page and am getting below error. I don't want to use standard EDIT ALL button as I ...
1
vote
1answer
84 views

Getting SOQL/SOSL Injection error when I send my code for security review

I have send my code for security review I am getting error for SOQL/SOSL Injection. I have made the changes on the bases they have mention in report. But even I am getting issue with dynamic soql I am ...
0
votes
2answers
24 views

SOQL: Compare result of Date Function with Date Literal in Where Clause

Say I have a query that goes something like this: Currency_Exchange_Rates__c cerRec = [SELECT Currency_Code__c, Exchange_Rate_Period__c, Exchange_Rate__c FROM Currency_Exchange_Rates__c WHERE ...
2
votes
1answer
19 views

Wrapper object and SOQL on Event and Accounts

I'm new to salesforce, apex and visualforce so please forgive me if I'm asking a dumb question. I'd like to have into a visualforce page a list of all events and related account (if any) of the ...
1
vote
2answers
107 views

System.LimitException: Too many query rows: 50001 for Test Class

I have come across this error in production but in a test class where I am defining 5 rows only , how come I'm facing this error ? Also there was no error in QA but error in Dev and Prod. ...
0
votes
0answers
29 views

Apex CPU time limit exceeded error for batch apex

I want to implement a batch sequence that takes a query of all the Territory Managers in the company and mark the top 15 Accounts as Focus Accounts. The Territory Owners field is a text field. The ...
2
votes
1answer
26 views

Where Statement issue with SOQL, after upgrade

Not sure what happened but I had the following Custom Controller working just great until recently. Not sure if it was the recent release or if I just completely missed the fact that it wasn't ...
0
votes
2answers
38 views

soql query returns a salesforce id

A SoQL query returns a salesforce object on a look up field. E.g. a long name: a80000000012345 How do i query that object and get it's fields instead of the salesforce id? I need the name from that ...
2
votes
3answers
140 views

How does one get table name in SoQL?

Newbie question. How does one get the table name for your object? Or is there a way to get the list of all the available table names with soql?
2
votes
1answer
46 views

How to query on OData(External Object) in Visualforce search page. using search string

I am trying to write a query on External Object using LIKE operator but its showing as error like, it is limited to use LIKE operator for OData Query. Is there any alternate way of querying? SELECT ...
1
vote
2answers
25 views

Relationship problem and 'Illegal Filter on Attachment'

I have a query like this: SELECT ParentId FROM Attachment WHERE Parent.Type = 'Contact' When testing with an account, I get an error saying: [MalformedQueryFault [ApiQueryFault [ApiFault ...
0
votes
1answer
15 views

Return the opportunities without a contact role?

I want to return the opportunities without contact roles, and this query doesn't seem to do the trick. Any suggestions? select count(contactid), opportunity.name from opportunityContactRole group ...
0
votes
0answers
5 views

What could be a better way to get to compare

Am still learning to get used to apex ways of coding-so this might be a silly question--so bear with me Below are the steps have take to handle a requirement-which i think could be done in a better ...
0
votes
0answers
15 views

Currency Conversion Issue

I am working on a OptyLineItem trigger that does a rollup summary on the Opty header of a custom currency field on the OptyLineItem. The default currency is USD and Advanced Multi-currency is ...
3
votes
2answers
103 views

How to remedy “System.QueryException: expecting a colon” within Batch query

I have a Batchable class for scheduling a lead reassignment process. I recently made some edits to the query string and nod I am getting the error System.QueryException: expecting a colon, found ...
3
votes
3answers
51 views

SOQL: Recent date grouped by AccountId

OBJECTIVE I am simply trying to return the most recent activity for a given list of accounts: List<Id>. I just want 1 row for each Account ID that gets passed. For each row I need the ...
0
votes
0answers
26 views

SOQL query on knowledge article

How to create a query that will give me the following information on Draft Knowledge Base Articles: Assigned to , Assigned by , Assignment Details (Instructions) ,Assignment Due Date These fields ...
1
vote
1answer
24 views

How to tell if rows were entered by a file vs. data entry?

(Warning: SQL expert, Salesforce.com N00b) Just by looking at the data, is there a way to tell whether rows were entered by a file import (and if so if you can get to any file properties), vs. data ...
1
vote
1answer
41 views

Get a list of Pick List Values

Via the SOAP API, can I get a list of the Pick List values from an Objects Field's type that is a pick list? For example, The Object Opportunity has a field called Type which is a Picklist. I would ...
0
votes
1answer
21 views

How to fetch the Account Name By selecting contact Name in custom object( communications__c)

I have a 2 fields in Communication__c (Custom object). field 1: Select_Contact__c (Lookup) (from Contact Object) field 2: Account_Name__c (Text). In Visualforce Page, when ever user selects the ...
2
votes
1answer
46 views

How to get Cases, Opportunities, Contacts Associated with Account Object Dynamically?

I need to get all the associated Contacts,Opportunities and Cases, for a given Account, if there are any. Right now, I am doing something like below: public List<Case> getCases(SObject sobj){ ...
1
vote
0answers
46 views

SOQL: How to query parent object column in child object? Salsforce - Apex Class

I need Help Here I have SOQL query: final List<Attachment> attachments = [Select t.Id, t.Name, t.CreatedById, t.LastModifiedDate From Attachment t ...
0
votes
1answer
31 views

SOQL QueryResult returns Account name with prefix 'Account' in InnerText

I'm using the Partner WSDL to query contacts via .Net. I have simple SOQL query that pulls back every Contact with their email and Account Name: SELECT Email, Account.Name FROM Contact However ...
0
votes
2answers
35 views

Can you query by LastModifiedDate on OpportunityHistory?

This query: select ID, StageName, Probability, Amount, CloseDate from OpportunityHistory where OpportunityId = 123 and LastModifiedDate > 2015-01-01T00:00:01z Throws this error: No such column ...
1
vote
1answer
25 views

Actual number of records in SOQL when Limit is used

I am using LIMIT in the SOQL query. When the results size is 60, I am displaying a warning message saying, upto 60 agreements are shown, please refine your search. String finalQuery = 'select ...
2
votes
1answer
240 views

Can I optimize this piece of code (SOQL query)?

Is it possible to optimize this code? I have 2 objects: ParentObj: The parent object ChildObj: The child object My code is as follows: List<ChildObj__c> result = [SELECT ID, ParentObj__r.ID ...
3
votes
1answer
49 views

Impact of adding namespace on existing code

I am trying out few lightening stuff and as a part of that I added namespace to my Developer edition. After doing this I realized that all my preexisting custom object's API name is now prefixed with ...
2
votes
1answer
34 views

GROUP BY / ROLLUP Query Rows

Why does using GROUP BY ROLLUP multiply the number of query rows returned by the number of fields you are rolling up + 1? Example: I have 3408 records in the database. If I run: [SELECT Sex__c, ...
1
vote
1answer
59 views

How Do I Write A Test Class For A Trigger Using The Below SOQL Query?

Dear fellow SalesForce StackExchange, I got the following SOQL query working in Workbench. (Note: If any IDs look invalid, it's because I did some typing-over them to anonymize my code, and I may ...
-1
votes
0answers
19 views

Bulk read session for version 32 with soql query containing UTF-8 getting corrupted and returning no data when data is present

I am using java api for starting a bulk read. SOQL query is being sent as InputStream. The soql query is - SELECT Account.Id ,Account.IsDeleted ,Account.MasterRecordId ,Account.Name ,Account.Type ...
1
vote
0answers
11 views

QueryException for visible managed package field?

I've got a basic query that references fields in a managed package. The field is visible to all profiles, and the object has view all perms for all profiles. But throws this query exception No ...
3
votes
5answers
56 views

How to I use SOQL to aggregate values and only return the largest sum?

I want to do something like this, but you can't nest these particular functions: select max(sum(Number__c)), User__r.Name, Category__c group by User__r.Name, Category__c If my result set ...
1
vote
1answer
61 views

Problem with test class - Too many SOQL queries 101

I have a test class that is failing due to too many SOQL queries. I'm assuming the fix is quite easy, but am struggling with how to bulkify the query. Can someone please assist? Full test class is ...
2
votes
1answer
38 views

Truncate or delete all records in a custom object

Using SOQL, how do I truncate an object or delete all rows. For example DELETE (Select id FROM MyObject__c) and delete [select Id FROM MyObject__c] and TRUNCATE TABLE MyObject__c All 3 ...
1
vote
2answers
97 views

Error: Didn't understand relationship 'Contract__r' in field path

So I have read other responses to the error like mines but nothing seems to fix the issue maybe someone can look at my code and help. I have in my controller class (trying to do an add and delete ...
0
votes
0answers
27 views

How to query for articles without a data category?

I can query articles with specific data categories, for example: SELECT Title FROM KnowledgeArticleVersion WHERE PublishStatus='online' WITH DATA CATEGORY Geography__c ABOVE usa__c But what if I ...
0
votes
2answers
27 views

SOQL: How to query for identical field values? ( SELECT form Object WHERE field1 = field2 )

I found a redundant Owner field in an Org, which I want to check if it's matching the standard Owner field or not. A very simple SOQL query - at least I thought: SELECT ...
2
votes
3answers
42 views

How to catch the field not in SOQL query error in a test class?

Is there any way to get this error: "Object row was retrieved via SOQL without querying the requested field: Any_Field_Name " in a test class so that if a new field has been added to the page, I can ...
0
votes
1answer
18 views

Aggregated Results

I'm getting Aggregate Results error when I turn my SOQL statement into an aggregate to get the newest record created when there is a duplicate record. How can I resolve this? ...
0
votes
1answer
50 views

Getting current contact record in Apex class

I am working in the Service Console. I have a VF page displayed as a component in the right side panel. I want to display all contacts related to the current contact based on a particular custom field ...
0
votes
1answer
22 views

How to create opportunity Using Connected App Callback URL

I have used bellow URL to get opportunity list using SOQL Query in .net Web application : token.instance_url +"/services/data/v33.0/query?q=SELECT+Id,Name+FROM+Opportunity" In SQL Query we can write ...
3
votes
4answers
164 views

Salesforce large query conditions: query 20000 contacts by emails and update fields

I have a csv file which has 20000 email addresses in it. I need to update some fields on these contacts. the dataloader is not suitable as I don't have the ID field of these email addresses. query in ...