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
14 views

custom setting SOQL vs methods

i often come across scenarios where we have some custom setting with lots of fields created which has rows for multiple purposes. So for a specific scenario, it is often needed to filter all the rows ...
1
vote
2answers
16 views

Grouped Query Call

I'd like to display a short table of Users and their Activities. I can get to the id but when trying to display the username I run into grouping issues or relationship issues. Here's my class: public ...
2
votes
1answer
29 views

What does this error mean - SOQL statements cannot query more than 35 different parent types?

From the Spring 15 Docs, I found this info under Relationship Query Limits: No more than 35 child-to-parent relationships can be specified in a query. A custom object allows up to 25 ...
-4
votes
0answers
23 views

Related to Soql Query [on hold]

I have written query on a object 'A'.The query I have written is correct ,but the error occurs ,when I use that query in apex class it shows '0' rows, but the same query execute in developer console ...
-1
votes
0answers
36 views

SOQL query not working [on hold]

I written one SOQL query,it shows result in developer console but when i use same query in my program it shows zero result.What is reason behind this could you give me suggestion ?
2
votes
0answers
34 views

Create New ContentFolderMember or ContentFolderLink through SOAP or Rest?

I'm getting errors creating both the ContentFolderMember and the ContentFolderLink objects from the new "Summer of 15" SOAP api. I am a Library Admin and I have been able to create the new ...
4
votes
1answer
33 views

Perform a SOQL Query LIKE Specifically for Lowercase

Is there anyway to perform a case sensitive SOQL Query? I have a field name "Policy Number" and I need to say something like: SELECT Id, Policy Number FROM Case WHERE Policy Number LIKE 'abc%' But ...
3
votes
2answers
67 views

Better for working with filtered DataSets: SOQL or FOR Loops

I have an Apex class where I have to grab a Dataset of custom objects and then perform some checks on various subsets of that data. I was wondering what would be the most optimized way of handling ...
2
votes
3answers
128 views

Simple lookup query failing, I'm not sure why

I have 2 Custom Objects, Parent and Child. Child has a lookup relationship with Parent. If I query Parent__c on the Child object, I get back the Parent object's Id, which is correct, But if I ...
2
votes
1answer
30 views

returning distance in soql select

Has anyone found a way to use the DISTANCE function in a SELECT phrase. I've seen how to use it in the WHERE and ORDER BY clauses, but what I'm trying to do is something like... SELECT id, name, ...
2
votes
1answer
19 views

How to get employee count via joins

I am trying to write a function that returns a list of companies and how many employees are under that company but am unable to figure out how to do this in a single request. Given: search term = ...
2
votes
2answers
35 views

Parent to Child SOQL

I have a Asset Table with Field Name like id and name. I have a child relationship of the following Test_Result__c.System__c with field like resultTest1 Select Name, id , (Select something from the ...
1
vote
2answers
40 views

Multilevel SOQL Query (Parent to Children) more than 1 level

I am trying to get some related contact information from a SOQL query but have run into the error "SOQL statements cannot query aggregate relationships more than 1 level away from the root entity ...
1
vote
1answer
14 views

Query Filter Sprecial Character (+) in Salesforce

I have a account 'H+S Aviat'. I am trying below query getting correct result. SELECT ID FROM Account WHERE Name LIKE '%H+S%' but when I am querying it like this SELECT ID FROM Account WHERE Name LIKE ...
1
vote
1answer
37 views

Retrieve all ContentDocument Ids whose related ContentDocumentLink record is updated/added

I want to retrieve File Ids for which new entry has been added or removed from child ContentDocumentLinks relation. Following is the parent to child relationship query I made for retrieving Ids, title ...
0
votes
1answer
12 views

How to query opportunities that have a Close Date in the past, but are within an account that has an opportunity with Close Date after Today?

How to query opportunities that have a closedate in the past, but are within an account that has a closedate after Today? Below is the query I'm trying to execute, but I get the following error: ...
3
votes
5answers
571 views

What's wrong with this SOQL

Declared a string and assigned SOQL value as shown below. While running I am getting an error. String country = 'United States'; String accountQuery = 'SELECT Id,BillingPostalCode,County_Name__c '+ ...
0
votes
1answer
23 views

How to handle email bounce and Email limit exceeded in salesforce using apex

How to handle email bounce and Email limit exceeded in salesforce. I am new in salesforce. I try too much but can not rid-off. So how to handle these problems.
0
votes
0answers
17 views

how many aggregate functions can be used in the SOQL query?

I am trying to write a grammar for parsing a SOQL query and while doing that I faced a problem where I need to find the maximum number of Aggregate functions (SUM (FieldName), COUNT (FieldName),... ...
1
vote
2answers
62 views

SOQL query not returning results

I'm querying Salesforce data via the API using the query : SELECT Id, field FROM User Where field IN ('value1','value2',....'value500'). This does not return any results, despite the character ...
1
vote
1answer
11 views

Get id from page

I am making a custom controller which is used to create a user from the account information but i am unable find id. How can i get account id to use in my controller. is there a method in salesforce ...
4
votes
2answers
53 views

Selecting fields from Contact based on Account subquery?

I would like to return all related contact names based on a specific set of accounts returned via a subquery, but keep receiving a MALFORMED_QUERY error. Running the following SOQL in Workbench is ...
0
votes
1answer
27 views

show selected accounts on visualforce page

i have is_active__C checkbox on account object. so my requirment is on visualforce page i want to take one check box as 'show active accounts only'.when ever its checked i want to show active accounts ...
0
votes
0answers
25 views

'with sharing' Class returning records that are not visible

I have a custom Visualforce page that is displaying Cases to Salesforce Community Plus users. A custom controller has the keywords global with sharing and a global static method annotated with ...
3
votes
1answer
68 views

SOQL Query : Parent to Child Query result

This is my SOQL SELECT ID,NAME, (SELECT ID,JUNCTION_TEXT__C FROM SPENDACCOUNT__C.CASE_SPEND_ACCOUNTS__R) FROM SPENDACCOUNT__C SpendAccount__c is the Master. Case_Spend_Account__c is the Child. ...
1
vote
1answer
30 views

SOQL: Differing results when adding a relationship field

I'm experiencing something strange with my SOQL results. Our salesforce has a custom sObject named Deals__c and an intermediary object, contact_deals__c which solves the m2m relationship between ...
1
vote
2answers
32 views

How to use the child objects in a related list after a soql call in Visual Force

My org has an account object with a related list of Contacts. I am querying for the Contacts from the Account and want to use the data on the Contact object. How can I access fields from the contact ...
3
votes
4answers
90 views

Is there SOQL editor with code completion / intellisense?

Basically I am looking to reduce the pain of adhoc queries that I currently do via the Developer Console. Is there such an animal?
1
vote
1answer
6 views

Compare Contract End Date to ActivityDate on Task of Child Custom Object

I'm going round in circles trying to figure out how to approach this one - I have a Contract with an end date The Contract has a child object (Contract Work) Contract Work has tasks I want to ...
2
votes
1answer
23 views

What are the differences between the SOQL filter statements and when should they be used?

Salesforce Object Query Language (SOQL) has a variety of statements that can be used to filter result sets. Some of these statements appear to do the same type of filtering but they must all exist for ...
4
votes
3answers
57 views

SOQL: Returning results where detail (M-D) count is at least 5

I'm trying to set up a query that will return which contacts have over 5 deals with us. We have a custom sObject which is (terribly) named, contacts_deals__c which serves as an intermediary table ...
1
vote
4answers
35 views

Poor Performing SOQL query

I have the below SOQL query which is performing poorly in my Informatica job: SELECT Job__c.Id , Job__c.Name , Job__c.Case__r.Id , Job__c.Case__r.Account.RecordTypeId , ...
2
votes
2answers
54 views

Need help optimizing a SOQL query

I am writing a simple trigger to tag lead duplicates based on two different fields, Email and our internal Lead ID (which we keep consisted between our own server DB and salesforce via integration). ...
2
votes
1answer
28 views

Take information from saleforce and input into licence generating tool in browser and retrieve licence generated

I am a computer science student intern and I have been given a project to complete in salesforce. I have never used salesforce before but have spent the last few weeks familiarising myself with it. ...
7
votes
4answers
143 views

Best Approach/Way to Query Single SObject record

To query a single record we have below two approach : Approach 1. Assign record to a single Account variable as shown below: Account accountToGet = [SELECT Name From Account where name = ...
3
votes
1answer
64 views

Nested Query in SOQL

I would return the Name of the User in PermissionSetAssignement for a specific PermissionSet. Here is my code: SELECT Name FROM User WHERE Id in (SELECT AssigneeId FROM ...
2
votes
1answer
21 views

Why does the SOQL parser give a primitive message like 'Unknown error parsing query'?

If you make a mistake/typo in a SOQL query in the Developer Console, you frequently get the - not helpful - message "Unknown error parsing query". I started programming in the early 80s, in BASIC of ...
1
vote
1answer
15 views

How do I compare a DISTANCE in SOQL with a number field?

I'm working on a travel price list function where I need to check if a customer inquiry matches a price list entry. The price list entry has a destination position (geolocation) and a radius ...
2
votes
1answer
46 views

Using List/Set in If Statement

Pretty basic question (I think), but after searching for a few hours and trying different things I can't seem to find a solution. Pretty new to Apex, but I do have experience in SQL, Java/C#, and ...
2
votes
1answer
18 views

SOQL Error = Activity Limits?

I've been told by a contractor that the code they've written (which is causing errors) is tied to a known Saleforce limit where a record may have a maximum of 5000 activities associated with it. And ...
0
votes
1answer
41 views

Need some advice in SOQL

I need some ideas, I have a MasterObject which has zip code information. Table structure is: zipcode Text(5) Minzip Text(4) Maxzip Text(4) CountName Text(25) Zipcode Minzip Maxzip ...
1
vote
2answers
48 views

Maximum of 42,000 Account records returned by query

We are writing an integration service between one of our systems and SFDC. The problem we are running into with the syncing of the data is that we're only able to sync 42,000 Account records from ...
2
votes
1answer
26 views

Query on Data Categories

I am trying to fetch data category groups and categories, so that i can use it in my VF page. how do i query(SOQL) so that i can see all available data categories?
2
votes
1answer
20 views

Polymoprhic query on a child of Opportunity

This is my first polymorphic query so I could be missing something quite simple here, but is there another way to write this without using the TYPEOF expression? I'm getting the error that "TYPEOF ...
6
votes
2answers
178 views

Does SOQL select records that are locked?

Does a SOQL query select records that are locked? I have a class where it selects a record, creates another kind of record based on the data, then inserts the new record and deletes the old. Now I am ...
2
votes
1answer
18 views

How to filter query for specific types of parent lookup?

String query = 'SELECT Id, isDeleted, LastModifiedDate, parentId FROM Attachment WHERE isDeleted = true AND LastModifiedDate >= :timestamp ALL ROWS'; for (SObject deletedObject : ...
5
votes
1answer
58 views

SOQL Find week by day

I'm looking for an easy way to get a week by day. So that, I have a function that get in input a day, and return all the accounts created in the week of that day. So for example if I call the ...
0
votes
2answers
29 views

Didn't understand the relationship AccountLocations__r

I have got two objects Account and AccountLocation__c with a master-detail relationship where AccountLocation__c.Account__c references Account.ID. Manual check does confirm the relationship. The ...
0
votes
1answer
26 views

Test Class for Extension including a SOQL query

I wrote the following class and it does what I expect it do on the vf page in Sandbox and so I started a test class but then my lack of apex knowledge and coding experience caught up with me. Please ...
0
votes
0answers
19 views

soql account ids of contacts and contact roles

I am trying to query a list of accounts of which my contact(logged in user) is contact of and on which it is account contact role is. For instance I have account s A,B,C Contact D D is contact of ...