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

learn more… | top users | synonyms

2
votes
1answer
12 views

How to avoid governor limits on soql query when you need an extra query for each record?

I have a little problem. We have 2000 records of type "Immobenutzer". So now I am facing the problem of governor limits. I need to log the logintimes for each user. So for each user there has to be a ...
3
votes
3answers
91 views

Lookup field value through query is gibberish?

I have a custom object (Team_Assignments__c) with a lookup relation (Team_Member__c) that references the User object. Team_Member__c should be the name of a user. However, my SOQL query for the ...
0
votes
2answers
41 views

SOQL: I need to display a Visualforce list of cases where each row can be expanded to display indirectly related cases

So there are 3 case records types: A, B, and C. A and C cases both have lookups to B cases, but otherwise have no direct relationship. I need to display a VF list of A cases where each row can be ...
0
votes
0answers
26 views

Update standard object fields from custom object

is it possible to update number of fields of standard object from custom object using apex and visualforce. We cannot call the API within the org. But however could we use SOQL for DML transaction ...
2
votes
1answer
22 views

SOQL Query to lookup field dependency?

A change needs to be done to this attribute/field Global Account Flag_c. In order to do so, I want to lookup dependency of this field Global Account Flag_c in all the objects present in our Salesforce ...
0
votes
2answers
22 views

Choosing first location of the SOQL

This very well may not be possible. I am performing a SOQL with a user's Id to get their name and I would like for this to be a one liner pretty much. What I'm wondering if there is a way to do is ...
1
vote
1answer
27 views

soql relation on lookup [on hold]

I have 2 objects from custom2 has a lookup relation to custom1 through field__c Now I have to delete some of the records of custom2 based on custom field on custom1 object when it is false. How to ...
3
votes
1answer
26 views

Assigning an integer variable a value from dynamic SOQL query

I was hoping I can get some help. So I have a wrapper where populating an integer variable inside a for-loop, with a SQL COUNT() query works well. example: eachwrap.numOpsPM = [SELECT Count() from ...
3
votes
0answers
19 views

Analyzing the Login History

My org uses Salesforce as a customer facing ticket system. Lately we've noticed that some customers are creating multiple accounts. We'd like to find out how many excess accounts we have. Our Login ...
1
vote
2answers
23 views

SOQL query, Master detail relationship for custom objects

I have to object Student and Student Object, based on student id passed throug query string I am retriving Student data using query, I have observed that, for the Student detail field the id is ...
3
votes
1answer
27 views

How can I filter through object using 2 separate fields as unique identifiers?

I have a custom object (we'll call it RS__c), and it theoretically has a 1 to 1 relationship to OpportunityLineItems (it is not possible to create a reference field directly to create this ...
1
vote
1answer
26 views

How to access fields from an inner query?

I have two custom objects. One parent, one child. I am using an inner query to obtain records. for(objectA__c obA: [select id, myfieldA__c, (select id, myfieldB__c from objectB__r) from ...
1
vote
1answer
28 views

Uncaught Reference Error

jScript for (var i = 0; i < {!pLat}.length; i++){ var marker = new google.maps.Marker({ position: new google.maps.LatLng({!pLat}[i], {!pLng}[i]), map: map ...
1
vote
1answer
34 views

No such column 'PersonOtherStreet' on entity 'Account'

I am trying to execute a query where i am fetching PersonOtherStreet field from Account. But its showing this error No such column 'PersonOtherStreet' on entity 'Account' If it is ApI version ...
-2
votes
2answers
46 views

Whats wrong in this code

List<contact> myContact = [SELECT Id,Name,contact.Account.Name,contact.Account.BillingStreet from Contact]; for(contact myCont : myContact) { for(Account acc ...
4
votes
1answer
108 views

Using Integers in SOQL For Loops - Apex CPU time limit exceeded

I need to insert Monthly Revenue Forecast records for each Opportunity that's been inserted / updated, matches my criteria and caused the trigger to fire. When I execute the below, in bulk via a test ...
1
vote
0answers
28 views

Read Access Denied For Visual Force Page

I'm trying to display a table of object permissions. However, when I try to connect my controller with my visualforce page, I'm am receiving a "Read access denied for ObjectPermissions." ...
4
votes
1answer
48 views

SOQL returns correctly when hard coded but empty with variable

This statement: String id = [SELECT id FROM Contact WHERE Name = :cvsData[12]].id; Returns this error (pulls nothing from the object): List has no rows for assignment to SObject This ...
1
vote
1answer
56 views

Convert aggregate result to decimal

I need to fetch the AggregateResult 'sett' for each Opportunity in a loop, from a map and convert them into decimals. I've seen Ariel's solution on this post but when I use it, it causes an error ...
4
votes
2answers
70 views

COMPILE ERROR: Incompatible value type System.Address for Map<String,String>

List<Account> accVar = [SELECT id,phone,BillingAddress FROM Account]; Map<String,String> findAccountName = New Map<String,String>(); for(integer i=0;i<accVar.size();i++){ ...
0
votes
2answers
34 views

List has more than 1 row for assignment to SObject: External entry point

I know that there's already several posts on SE for this error but none of them explain this for me. I'm testing my code by editing one Project Deadline date field, the upProjects size is one and as ...
1
vote
1answer
26 views

Limit SOQL Results Based On Child Records

With a Visualforce page for my Community, I am trying to limit the records returned from a SOQL based on criteria of child records. I have a custom object Sale (parent) and custom object Sale Related ...
5
votes
1answer
44 views

SObject row was retrieved via SOQL without querying the requested field. Transaction_Survey__c.Transaction_Score_Other_Reason__c

I'm getting this error in a Visualforce page I'm working on. I understand that this error comes up when you try to reference a field you haven't queried, but the problem is, I have it referenced on ...
0
votes
0answers
28 views

Updating, Deleting or Inserting records based on match with Integer

The below inserts a Project Month record for each month between a Project kickoff and deadline date. I now need to update existing Project Month records whenever one of the Project dates are changed. ...
0
votes
0answers
20 views

Apex SOQL Relationship [duplicate]

I often come across scenarios where i have two objects related through lookup / master - detail relationship. I need to find using apex and SOQL that for each parent record, these are the number of ...
2
votes
2answers
44 views

Comparing Lead/Opportunity Data with a Custom Object

I am writing a trigger for a custom object Data_Vault__c where data such as Company Name and Postcode are entered, this data is then compared to corresponding fields on Lead and Opportunity, if a ...
2
votes
1answer
65 views

SOQL Aggregate calculation error due to multi-currency

I'm trying to calculate the SUM of all values in my Target__c field, on my Target__c custom object. When the below code is executed, my debug log shows that updatedTargets contains the correct target ...
2
votes
2answers
53 views

Subquery in Junction Object, can't get relationship

I've got a Junction Object, Product_Dependencies_Association which has a Mast-Detail Relationship to a My_Custom_Product__c Object named Child_Product__c and a Lookup relationship (not Master-Detail) ...
1
vote
2answers
65 views

How can I return only objects where the sub-object exists?

I'm doing this query Select id, name, (select quantity, PriceBookEntry.Name from OpportunityLineItems where quantity != NULL) from Opportunity where StageName = 'Closed Won' And it'll return a ...
0
votes
0answers
14 views

Is there a way to use aggregate functions to filter results based on the presence or absence of related records?

I'm trying to write SOQL queries to count and sum the gifts of three different kinds of donors: those who give only one-time gifts, those who give only recurring gifts, and those who give both ...
1
vote
2answers
47 views

Querying a field on an unknown object type

I have the ID of an object that could be either an account or a contact or a few other object types and want to query the name of the object regardless of the type and pass it to a string. I am ...
2
votes
2answers
84 views

Using a selected field of a Subquery in WHERE-Clause of the main query

I am relative new to Salesforce, Apex an SOQL. Since now I could help myself with Google, but unfortunately on this question no answer showed up. We have a customer object which is called ...
0
votes
1answer
18 views

Can a querylocator be used across connections

I want to execute a query which will return huge number of records. I want to execute it in parallel by running it in separate nodes. Is it possible to use a single querylocator with many ...
3
votes
1answer
72 views

How to get the actual result size of a SOQL

I am using SOAP API to execute a SOQL. I need to get the size of my result Does QueryResult.size() returns the actual size or the number of rows returned in the current execution Consider I've a ...
1
vote
2answers
20 views

Query to get All Opportunities that between Start and End Date

I am writing a report for which I need to break down the monthly revenue. So Given the Report Parameters (Start and End Date). Given an opportunity's start and end date if any of the dates during ...
0
votes
0answers
13 views

Get CreatorFullPhotoUrl from Case Comment without enabling Chatter Answers?

I wanted to include the FullPhotoUrl(without Chatter Answers) when querying CaseComment, tried this query: select CommentBody, CreatedById, CreatedDate, CreatedBy.Name, CreatedBy.FullPhotoUrl from ...
-1
votes
0answers
17 views

Query Case and Case History Table through the Salesforce API

I want to get the records from case table as well as want to get the records from the case history table in a single query. Can anyone suggest me the query.I am using PHP ToolKit.
0
votes
1answer
17 views

Get Grandchild Object Field Values from Parent Object

I'm a newbie at sales-force apex coding. I have 3 custom objects, Location(Parent) -> Group(child) - > Meeting(grand child). All are related to each other through Master detail relationships. I am ...
0
votes
1answer
51 views

Find record based on two (or more) variables

I have a custom object Target__c (we can't use Quota's to track targets in our org) which I will link to Opportunities through a junction object TargetxOpp__c. There are two Master Detail fields on ...
1
vote
2answers
32 views

Get a list of one column from a SOQL result?

I have a SOQL query result that I use several times in a method. It pulls in many columns that I use for a few things. This includes a relationship column, that I do a query on another object. Is ...
3
votes
1answer
73 views

security considerations while using url parameters in soql as bind variables

on most of our pages, we have some url parameters. we use these parameters as bind variables in various SOQL queries. is there a common pattern we can use which takes care of security issues.
0
votes
4answers
50 views

query flat list of records including parent and child fields

I have two custom objects in a master detail relationship where Proposal is parent and Question is child. I need to create a page where all the questions in the DB are shown along with certain data ...
5
votes
2answers
165 views

Please help me turn this SQL query into SOQL query.. I'm stuck

I've been trying to figure out how to turn this SQL query into a SOQL query. Every time I think I am getting better with SOQL something comes along and erases that thought. Account is the parent ...
0
votes
2answers
42 views

Querying all fields of an Article in Apex

I'm a bit confused about the way Knowledge Articles work. To try them out, I've created an Article type, added a single custom field and created a draft article with some dummy data. The goal is to ...
3
votes
2answers
59 views

What is the coalesce() eqivalent?

Much like this post here: SOQL: Avoid count with NULL results return 0 (zero) instead I have an instance where I am using aggregate functions like COUNT() and MAX() on a collection of Opportunities. ...
-1
votes
1answer
15 views

Get Opportunity StageName from helper class on OppLineItem

I'm trying to get the Opportunity Stage value from the Opp Line Item Object but my query returns a null value. What am I missing in my "If" statement? public static void ...
1
vote
2answers
66 views

101 SOQL Queries Limit Exception

Even I think I have bulkified my code still it is throwing SOQL 101 Limit Exception on below code on Line 5 (For loop One). What I am doing Wrong? UserIds is just a list of Oppportunties.OwnerIds ...
2
votes
2answers
24 views

Trigger : Mapping of Opportunities indexed by AccountId

I am writing a trigger for the beforeInsert event of the Opportunity object. What I am trying to achieve is, generating a value for one of the Opportunity's custom fields(Ref__c), that is, a ...
1
vote
2answers
34 views

Remoting Exception: Attempt to de-reference a null object when attempting to get a field from an SObject

I am attempting to grab the value of the "Status" field from an SObject. @RemoteAction public static String getStatus() { Id NTHRecordId = ApexPages.currentPage().getParameters().get('id'); ...
3
votes
1answer
75 views

Select the last consecutive days SOQL?

Is it possible, with SOQL only, to select something for a consecutive date? Expect following table(where 2012-01-07 is today): User LoginDate Whatever 1, 2012-01-01, 0 1, 2012-01-02, ...