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

learn more… | top users | synonyms

1
vote
2answers
22 views

SOQL query for fetching country, city of an account

I am new to SOQL. How do I fetch the country,state,city of an account? I have tried this but have an error. Select AccountNumber,name, BillingAddress.City from Account
3
votes
1answer
59 views

How to use ORDER BY and GROUP BY together in the same query

I am trying to retrieve a list of LoginHistory for a bunch of users, but only want the most recent LoginHistory for each user. I have been trying this query, but I keep getting an unknown parsing ...
0
votes
1answer
24 views

How to write a join query for custom settings object and User object? [on hold]

I need to get a report with some fields of custom settings and some fields of user object. For example XXX__c (custom setting) has one field like Ordering_Party and User has field like ...
0
votes
1answer
20 views

Using variable in Query

Can I use variables for objects in my SOQL query? I have the variable like: public sObject objectvar; Which gets a record of type Account. How can I use this variable in my SOQL query like: Select ...
0
votes
1answer
17 views

count rows where earliest date in range

I am trying to get a count of rows where the earliest date of a given field falls within a range. What I am looking for is this: SELECT COUNT(AccountId) FROM Opportunity WHERE StageName ='Posted' ...
1
vote
0answers
15 views

How to query/fetch public feed elements in a community to which the user is not subscribed?

Use Case Display a list of all public questions and posts to a community user, regardless of whether or not that user is subscribed to the groups or users who posted. What we've tried SOQL query ...
1
vote
1answer
25 views

How to SOQL query a Filtered Lookup on same Object?

I am trying to a subQuery for records of a specific Opportunity type that lookup via a Filtered Lookup, 'parent' Opportunities of another record type. This is the latest subquery tried so far: ...
1
vote
1answer
32 views

Using soql query how to get all events from startdatetime to enddatetime in apex

Hi i want to get the all the events in between startdatetime to enddatetime.but i am not getting the records. My code is: @RemoteAction public static string eventdata(Datetime starts,Datetime ...
1
vote
1answer
19 views

SOQL: Query Time Frame values which appear in Report layout

I have to replicate Report layout using Visualforce and add Time Frame picklists (Fiscal Year, Fiscal Quarter, Calendar Year, Calendar Quarter etc.) based on today's date. Is it possible to query ...
0
votes
1answer
30 views

Find the first 1 million record's created date

I have a requirement to find out the first 1 million record's last created date. As we have about more than two million in the system. As both SOQL queries and offset have less than 10000 limit, how ...
0
votes
0answers
21 views

How to optimize joined query to find obsolete data

We have a query to find and remove the obsolete data which looks like this: select Id,Name from Matter__c where Id NOT IN (select Matter_Number_Lookup__c from Matter_Sitting__c) So if a matter ...
0
votes
1answer
39 views

How can i create a radio button dynamically in lightning component from picklist field values in salesforce

I want to save the radio button(lightning component) value in salesforce. I am unable to do so. When i try to select any one of the radio button error says resultCmp.set is not a function. Here is ...
-1
votes
1answer
17 views

MALFORMED QUERY : [object Object]: Field must be grouped or aggregated: Name

SELECT Account.Id,Account.Name,Account.Phone,Status FROM Case WHERE Status='Closed' GROUP BY Account.Id It displays an error while qurying this.Anyone please help me to correct this.Thanks in ...
1
vote
1answer
72 views

Is there a bug on the when querying the FieldHistoryArchive table?

Is there a bug on the when querying the FieldHistoryArchive table? Background: The FieldHistoryArchive table is neither available from dataloader nor dataloader.io So I had to go with Workbench on ...
1
vote
0answers
31 views

force cli query for more then 2000 records

When using the force cli query. It works great and is very fast, but I want to get all records and it only grabs 2000 records. I think that it is limited by soql. How do I get all the data on an ...
1
vote
1answer
34 views

Need help with SOQL query

I need query on Case and its child object 'Case Status History' such that I need cases whose Status='closed' and I need the latest 'Case Status History' record for each case. The 'Name' field of 'Case ...
0
votes
2answers
37 views

junction object soql query in apex

I have 3 objects: university is the junction object, remaining 2 are master, in university I have to query and get the records from remaining 2 objects. I use the following code: ...
0
votes
0answers
23 views

Query to retrieve info of custom field in salesforce [closed]

Please help me!! I need a query to retrieve Created Date/By , and Modified Date/BY field information in Salesforce via SOQL query
0
votes
1answer
20 views

SOQL query to find a row with the longest string in a column

I was trying trying to figure out if there is a way in SOQL to select/sort rows in a table with the longest Strings in a selected column. Something similar to: SELECT Id, Name FROM User ORDER BY ...
0
votes
2answers
29 views

Retrieving Dynamic SOQL results. Runtime error - “Invalid field Owner.Name for…”

I had a question in regards to dynamically retrieving the results of Dynamic SOQL that I have set up in my controller. I want to be able to access fields on the Lead object (Lead.Name) itself as well ...
2
votes
0answers
26 views

SOQL returning last modified contact matching each email address in set

I am trying to bulkify a trigger to match transactions with contacts by email address. There are many contacts with duplicate email addresses and getting rid of these duplicates is not an option. I am ...
1
vote
2answers
48 views

How to get child objects from Junction object

I have a list of VisualForce components called VFComponent, a list of attributes name VFAttributes and a junction object VFComponentToAttribute that links them in a many to many relationship. I am ...
0
votes
0answers
17 views

how to find child objects and child relationships for a particular object(Parent) using apex code with detailed code [duplicate]

could anybody help me on below. how to find child objects and child relationships for a particular object(Parent) using apex code with detailed code
0
votes
1answer
44 views

How to Format the numbers entered in the Input Text Fields

When i try to search with 1000000 and 1500000 in Price Min and Max fields.the soql query is executing fine.but when i enter the values seperated with commas like SFmin=10,00,000 and ...
0
votes
4answers
37 views

SOQL for a lookup relation

I have a custom object Called 'Interest_Level__c'. From contact I have a lookup to Interest_level__c object with relationship name 'Contacts' and Field 'Interested__c'. Now I'm trying to get the ...
2
votes
1answer
28 views

Getting a list of custom Visualforce components

I am trying to write a class that will list all custom Visualforce components in an .org on a page. I see that my custom components are included in the component reference at ...
2
votes
1answer
15 views

Performance under large data - standard features

When the number of records in the database increase, logically there must be decrease in performance. This degradation can be explicitly observed in SOQL/list view/reports on such orgs especially ...
4
votes
1answer
28 views

How to access fields from the inner join

I need to access the fields from the nested Select statement. Here is the code Select Name, id, (SELECT id FROM Account.Contacts) from Account where id = '0011a000004eVlYAAU' How do I ...
5
votes
2answers
29 views

SOQL Filter OpenActivties & ActivitiesHistory Query

I am working with ActivityHistories & OpenActivties and trying to see if there is a work around to my issue. This query works but returms accounts that do not have the specific activities Select ...
2
votes
2answers
46 views

How to extract first 3 character from a name field [closed]

Is is possible to extract first 3 letters of last name using soql?
6
votes
3answers
287 views

Why I can not use Map in dynamic query

Map<Id, Account> maps = new Map<Id, Account>(); for(Account acc : [Select Id from Account]) { maps.put(acc.Id, acc); } String s = 'Select Id from Account Where Id IN : ...
0
votes
2answers
26 views

Accessing data via Apex from a relationship SOQL

Can someone tell me how I can access the data from child object via Apex from a relationship SOQL ? This is my SOQL SELECT Opportunity.Id, Opportunity.Max_Loan_Amount__c, (SELECT Application__c.Id, ...
1
vote
1answer
704 views

Bulkify the code?

I want to clone the Opportunity record if some conditions satisfied in Opportunity car set which is in related list. Opportunity (Master)--->Opportunity car set(Child) My below code is working ...
3
votes
1answer
32 views

Using next method in iterator

In my code below: List<Skill__c> skilist = [ select Id,Name from Skill__c where Skill__c.Id IN:sl.keySet()]; Iterator<Skill__c> iter = skilist.iterator(); ...
1
vote
1answer
36 views

Proper way to implement Junction Object from SQL tables

I was trying to compile a list of VisualForce components (but this could be any data really) and their attributes and put them in an Salesforce custom object. So I did this in a way that was geared ...
3
votes
1answer
28 views

How to determine a list of Opportunity fields by API name that are on the page layout?

How to determine a list of Opportunity fields by API name that are on the page layout? For example for the Opportunity Object: I have created a custom field whose API Name is "My_Custom_Field__c" I ...
0
votes
1answer
8 views

Oracle SQL to SFMC Date Issue

Running a query to send email subscribers a +X day email. FIRST_PROMO_SUBSCRIBE_DATE is coming from Oracle which they say is not a compatible format with Salesforce SQL so I have; select * from ...
1
vote
2answers
56 views

Weird limit exception retrieving 18 rows :?

I'm repeatedly getting following known exception: Too many query rows: 50001&nbsp; An unexpected error has occurred. Your development organization has been notified. The thing here is that my ...
1
vote
1answer
26 views

Access / identify Role GroupMembers in Apex

If I know the Role Id of the logged in the User. Can I determine which Groups the Role Id is associated with? When I query the GroupMember object - using something like this SELECT Id, Group.Type, ...
4
votes
1answer
54 views

SOQL: No response from the server error

I have below query to run either in workbench or Developer console, query editor. While on workbench, I get error: UNKNOWN ERROR: Error Fetching http headers and in Developer console error as No ...
2
votes
2answers
77 views

SOQL query failing when comparing formula field and currency field values

I'm having trouble trying to figure out what's wrong with this SOQL sentence: SELECT Id, FormulaField__c, CurrencyField__c FROM MyTable WHERE FormulaField__c != CurrencyField__c ...
0
votes
1answer
22 views

Parent/Child on same Case object : NullPointerException: Attempt to de-Reference a null object

My question is continuation of what I have asked here How do I replace from: parentChildCase.get(cMap.get(c).ID).add(cMap.get(c)); to this Id (pId): Map<id, id> par = new Map<id, ...
2
votes
1answer
43 views

SOQL Limit Hit - Aggregrate

My query hit the 50,000 record limit. Can someone help me rework the query so it operates within the limits. For reference, we have one account that has 92,000 active employees. The aggregate ...
3
votes
2answers
53 views

How to define a map with id and list<case> of records

I need to store it in a map with List as child and Id as parent For an example my data spit something like this just to give you an idea: DEBUG|//PId : 500o0000008V0alBAC DEBUG|//Child: CaseNumber: ...
1
vote
1answer
37 views

get all members of public group EXCEPT where they are managers if a member

I am using the below code to get the members of a public group, plus all the indirect members (either members of a child group, or associated by their role membership) public class GetAllGroupMembers ...
2
votes
4answers
111 views

How do I delete data from a large-volume custom object in Sandbox

We have a Sandbox environment with storage limit 2 GB, while alone Order_item__c storage amount is 1.8 GB. We are trying to delete the record using the filter Year<=2013 from ...
0
votes
1answer
18 views

System.QueryException: List has no rows for assignment to SObject but running the query in Developer Console returns results

I am new to Apex. Writing my first test class for a trigger. I need to insert an opportunity for the test. The opportunity has a lookup to an object called Program__c. I am using SOQL to find the ...
1
vote
2answers
34 views

SOQL Query Records without Attachments

What is the best way to find records without attachments? My current query will pull all records meeting the criteria in the WHERE clause, however I need these records filtered down to those ...
3
votes
3answers
54 views

Comparing subqueries in Apex where clause

I am having a hard time with a SOQL query. I want some data from a table using two like conditions on Name. How can I correct my query so that it is a single query rather than two separate queries? ...
1
vote
2answers
31 views

Display History tracking section in visualforce standardcontroller

I am using standard controller of a custom object called Enagements__c to display details of the record in VF Page. I want to use the standard feature of '<apex:relatedlist' and display all the ...