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

learn more… | top users | synonyms

0
votes
0answers
16 views

Report on opportunities with certain activities?

How would I create a report that showed all opportunities with at least one activity, whose most recent activity was this month, and contained the word "foo"? (I'm a total SFDC novice -- if there are ...
0
votes
0answers
25 views

Good introduction to querying SF for a SQL expert? [on hold]

I'm really comfortable with SQL. Don't know a thing about Salesforce. What are some good, step-by-step-from-the-beginning resources to help me learn how to write custom reports in Salesforce? (Or is ...
0
votes
0answers
22 views

Sorting Aggregate Results VF Page

working with VF Page page block table and attempting to display count of "sales" broken up by different carrier buckets. In my SOQL Query, I am able to easily get the rep's name and total number of ...
1
vote
2answers
40 views

Unable to retrieve value from lookup field

I am trying to get values from my object which have Contact as Look up field. But when I am trying to get value of Fields from Contact Object using relation I am unable to get any result. EX: ...
3
votes
1answer
48 views

Where Statement issue with SOQL

I am trying to do the impossible here. I have a parent object that I am querying along with 3 of its child objects. I have filtered each of the child objects and the parent objects based on an input ...
1
vote
2answers
28 views

how to set up a method to be always called the first time when it enters a class

I need to add a method to cleanup a table (a custom object in SF) before any other methods in that class are called. I tried calling that method in the class's constructor,and later realized that I am ...
10
votes
4answers
402 views

Howto wildcard SELECT * to query all fields of objects in APEX?

I have created sObject and I need all the fields and I have many. Is there a way I can directly get all of them rather then typing each one of them.
2
votes
1answer
33 views

How to increase the number value of a field in sobject

I am trying to increase the value of number field in an SObjects, how could I do this ?
1
vote
2answers
20 views

Find if records exist with custom field comparing and as little SOQL as possible

I'm writing a trigger that needs to create a record based on a newly inserted one. The trigger I have now works, but only for small amounts of records. The problem is where I need to check if there is ...
2
votes
1answer
33 views

triggers on opportunity stage and probability to prevent the opportunity stage from regressing to a lesser value

For example, probability is high like 70% and it will not revert back with decreasing of probability. Like negotiation review - 90 And it will not back to Value proposition - 50
0
votes
1answer
21 views

Fetch the records based on the topics

Can anyone tell me how to fetch the records based on the topic name.. Like I have 20 contacts ..10 contacts are associated with the topic name test1 and others are test2 Wanna fetch the records ...
3
votes
1answer
46 views

Getting the error, too many aggregate queries 301

I have a test class in sandbox and while clicking run test i am getting error message, too many aggregate soql queries 301. I tried to find this error on internet and salesforce documentation however ...
0
votes
1answer
29 views

SOQL WHERE clause use an Sobject's field?

I'm doing a SOQL query and am trying to use a field from that result in a 2nd SOQL query but it errors with "Initial term of field expression must be a concrete SOBJECT: LIST". Code is: ...
1
vote
1answer
29 views

Need to Filter a VF page with date input and pass to SOQL statement in controller

I have been working on this for a few weeks now so any assistance would be wonderful. I am trying to create a report with a VF page to pull information from some custom objects and their associated ...
4
votes
3answers
102 views

Test Apex Code: How to emulate a SOQL call that has a related object?

For Apex testing, I'm trying to create an object that is the same as the one created with a SOQL statement (see following method). The method retrieves the Quote_To_Lease__c object from Salesforce ...
4
votes
1answer
32 views

No such column 'AccountNumber' on entity 'Name'

I am getting error 'No such column 'AccountNumber' on entity 'Name' when i tried to execute the following query, select parent.AccountNumber, parentid, subscriberid from EntitySubscription where ...
0
votes
0answers
22 views

Updating Task with Mobile SDK (Native Application)

What is the easiest way to update entities like Tasks via the Mobile SDK? How about creating or deleting entities?
1
vote
1answer
41 views

Duplicate id founds while select query is fire

I am doing coding in Eclipse. I am using SOAP API for that. there is method called query() i am use following code PartnerConnection connection = ForceConnection.getOrgConnection(); ...
1
vote
1answer
43 views

Offset value as a variable

I have to put an offset value in a query as a variable.Can someone please help here?Please my code snippet here. Integer lim=101; for(Integer i=0;;i+lim){ Integer j=i-1; return ...
0
votes
1answer
24 views

SOQL join question

Not sure how to handle this in SOQL: There are Customer objects and Order objects. A customer can have many orders I want to select the DollarValue__c of each customer's oldest order? I'm ...
1
vote
2answers
101 views

Pagination in apex

I am getting an error of limit exception in salesforce for SOQL results more than 1000. I need to show 50000 records in a pdf page(may be in different pages). Can someone help me here to do ...
1
vote
1answer
21 views

Error: Field must be grouped or aggregated - how do I join other fields?

My question is slightly similar to this one: I have a query that works fine: select bank__r.id, min(processedDate__c)min from cashflow__c group by bank__r.id and I want to add another field ...
0
votes
1answer
25 views

Opportunity Trigger

I have the following trigger: trigger UpdateOpportunity on Opportunity (before insert, before update){ Opportunity[] oppQuery = [SELECT ID, RecordType.Name, StageName, Win_Reason__c, ...
0
votes
2answers
44 views

SObject row was retrieved via SOQL without querying the requested field: Opportunity.Unsolicited_Bid__c:

I get the following error in my SalesForce app: Error:Apex trigger UpdateOpportunity caused an unexpected exception, contact your administrator: UpdateOpportunity: execution of BeforeUpdate caused ...
0
votes
1answer
14 views

How do I reference related record (__r) field value from query

I don't know how to reference the value of the Job_Matching_Title__r.Salary_Range_Avg__c field from this query: List<Position__c> Positions = [SELECT Name, Department__c, ...
1
vote
1answer
20 views

building a query that it returns the quantity of contacts modified in a 2 or more range of hours

I'm trying to build a query where it returns the quantity of modified contacts between two specific hours today grouped by a hours range, for example, the number of contacts that were modified between ...
1
vote
1answer
41 views

SOQL Parent child relating issue

I have to pass a child record's field value while iterating by Parent records. I am getting invalid Foreign key relationship error. Can someone please help me here? Code snippet: global class ...
0
votes
1answer
29 views

Query result optimization

I have a custom object Call2_vod__c which is detail of Account.There might be 100 calls for one Account.I need any one call record with that Account. How should I do the query? Please find my piece of ...
1
vote
1answer
32 views

Send list in HTTP Request in particular order taking order by as row num?

Apex code: List<order_batch__c> bcList = new List<order_batch__c>(); bcList= [select ...
1
vote
1answer
15 views

Multi Value Results from Nested Query

I have a parent-child nested query like to this: SELECT Name,CloseDate,Theatre,(Select Product__c from Opportunity.OpportunityLineItems) from Opportunity where Name = 'Foo' The result of which, ...
1
vote
1answer
49 views

Force.com sites - public access to account/contact records

I have a force.com site, it has a visualforce page with a controller that is doing a very simple SOQL query to the database, which for some reason it's not returning any records. Here's what I've ...
3
votes
1answer
45 views

VF Performance Issue

Salesforce recently notified us that "a VF is consuming high levels of DB resources due to inefficient SOQL in your VF controller." I believe I have identified the issue down to this query: ...
1
vote
1answer
22 views

Salesforce not letting select country from a relationship, but allows name and id

I am running the following query in salesforce to get the country SELECt name, owner.country from lead This gives the following error: No such column 'country' on entity 'Name'. If you are ...
4
votes
2answers
70 views

System.QueryException: No Such Column - Strange RunAs Behavior with Summer '14?

Question Is there any known reason a SOQL Query would return a runtime System.QueryException on a custom field in test methods, in particular one one via a parent lookup in a test? I would have ...
5
votes
5answers
293 views

Why isn't a SOQL query of mine populating a list in an Apex test class?

Why does my taskOpp query below not return any records when I run this test? The query works fine in Workbench and my taskRT query works fine in both my code and in Workbench. public class ...
0
votes
1answer
17 views

Customer Portal User foreign key in Contacts?

When enabling Customer Portal access for a Contact, Salesforce creates a new Portal User for the person. I am creating an apex trigger for when the user creates a record in an object and would like to ...
1
vote
3answers
73 views

Pass result of SOQL query into a variable

I have the following query: public List<My_Main_Object__c> data; data = [Select My_Object__r.Id FROM My_Main_Object__c where id=:XXXX]; How can I pass the result of this query into a ...
0
votes
2answers
25 views

How can I query Orders to get OrderItems associated with that order

I see that there is a related list on Orders showing the OrderItems but there is not field on orders that I can SOQL query in Apex.
2
votes
3answers
175 views

How do I assign the returned query values to each Boolean?

If I have the following variables and query, how can assign the values of each field to their corresponding boolean? The fields are Checkboxes on the 'myObj' object. public with sharing class MyClass ...
0
votes
1answer
26 views

Programmatically determine relationship between two sObjects and generate result

I have an application which allows the user to specify a geography object and field. For example User's country field Account's State Field Now for Leads the system needs to dynamically determine ...
1
vote
1answer
52 views

Get the max value of a field with many records

I have a field that stores an ID, and I need to find the Max value of that field. However I get an error a queryexception. For reference, the field is set up as unique and external Id. Any ideas on ...
2
votes
1answer
85 views

Problem with deciphering query

I am new to a Salesforce organisation and currently I am trying to make sense of the organisation's apex code. I came across this query and for the life of me I can't figure out what it does. This is ...
7
votes
1answer
55 views

Get Count of ALL Records (All Objects) in Recycling Bin

Looking for a SOQL query (or some other method) to get a count of records in my orgs recyclying bin. I have seen other solutions posted suggesting to use the IsDeleted = TRUE and ALL ROWS to the SOQL ...
0
votes
2answers
40 views

SOQL Query for month operator

I have to compare month value of a custom object's date field, if it is of the current month. Please find the piece of code below. I am getting error here. Can someone help me? Code piece: ...
1
vote
1answer
32 views

Query the cases where case contact = logged in user's contact

for(Case c: [select id from case where ContactId = :UserInfo.getUserId]){ System.debug(c.user.Name); } Am not able to get logged user by case
1
vote
1answer
33 views

How do I use a field to populate the mail.setToAddresses in a sendEmail class

I have set up a class that sends an email and I am using a VF Email Template that uses the Oppertunity fields. I have set up a custom field called Proposals_Senders_Email__c that is a text field. I ...
2
votes
1answer
26 views

delete look up reference

I have two objects A and B. I have a look up reference of B on A. In certain cases, if the A has B reference, I would want to delete the look up it by making it null or blank, so that I can look up a ...
0
votes
1answer
28 views

Retrieving custom fields via QueryResult

I'm new to using SOQL and QueryResult. I'm using C# and the sample code from here: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_quickstart_steps_walk_through_code.htm I'm trying ...
0
votes
2answers
21 views

How to retrieve latest Notes inserted to Custom Object

I have Custom Object that contains many Notes for each record.I want to retrieve the latest Note inserted for all the Records. List<CustomObject__c> = [select (select Body from Notes order by ...
1
vote
1answer
41 views

How to write a SOQL for a salesforce report

How do I get the SOQL query for this report?