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

learn more… | top users | synonyms

2
votes
0answers
14 views

ERROR(Save Error: duplicate Alias: Name) when using Day_Only

I'm using the following SOQL query to populate a custom controller for our sales team to view their opps on the opp tab landing page. It works fine with CloseDate alone, but the field is returned as ...
3
votes
1answer
46 views

SOQL with polymorphic fields

Confused about the behavior of polymorphic fields in SOQL, sometimes you can select parental fields through a polymorphic relationship and sometimes you cannot. For example on Task with Who ...
1
vote
1answer
27 views

What are race conditions in salesforce

Could any body let me know that what are race conditions that are being prevented by Record Locking? IF possible please let me know at least one example.
0
votes
2answers
47 views

Need help in removing the SOQL query inside FOR loop

I have a custom object "Proposal Line Item" which has a lookup to another object "Quote". "Quote" object has a lookup to "Account". This "Account Id" is present in "Proposal Line Item" object as a ...
1
vote
1answer
29 views

SOQL Statement Help

How do I a condition to the my statement below to exclude product Name not containing "RENEWAL". The field is Name on OpportunityLineItem. SELECT Name, StageName, Amount, CloseDate FROM Opportunity ...
1
vote
1answer
28 views

remove entry from a list

for(integer j = 0; j < IPList.size(); j++){ t = ''; system.debug(t); for(Integer i = (IPList[j].Product_Releases_del__r.size()-1) ; i >= 0; i--){ Installed_Products__c x = ...
1
vote
2answers
194 views

unexpected token: '2015-07-28'

String query= 'Select Id from Account where isNew__c = true and Start_Date__c <:'+ Date.today() +' or End_Date__c <: '+ Date.today() '; What I'm I missing in this query? I tried using a date ...
1
vote
2answers
27 views

Old and New Values of Parent fields with Re-parenting on Child Trigger

I know we have to query the parent fields to access them on the child object trigger. How can I get the old and new values of the parent fields when its parent record has been changed. I have two ...
2
votes
2answers
31 views

Can You Update Fields via Dot Notation?

I have two custom objects, Subscription and Product User. Product User is a child object of Subscription in a Master-Detail relationship. In a trigger I have built, I want to update a lookup field (to ...
2
votes
1answer
25 views

Help On SOQL Statment

I have 3 objects (CBR__c, Account, AccountTeamMember). CBR__c and AccountTeamMember are both Child objects to Account. Here are the fields I'm trying to retrieve: CBR__c.Id, ...
0
votes
1answer
12 views

How to query on Category group to find all child or subcategories. ?

I have an issue. In knowledge base i have two Category groups, One is A and other is B. Now under A i have ALL--->Subcategories. Now i want to write a query which can get me all subcategories under ...
1
vote
1answer
41 views

Custom soql return too many rows

What is my best option to return the results of a query where the soql query by default returns too many rows (>50k)? From my understanding, SELECT COUNT() still cannot return a result >50k, but my ...
2
votes
2answers
35 views

Display an aggregate result on a visualforce page

I try to display on my visualforce page the result of a soql query (an aggregate result precisely). Here is my controller (a partof it) : public List<AggregateResult> somme {get; set;} public ...
-1
votes
1answer
24 views

Use group by and limit at the same time in Salesforce report

Good day everyone, I have question about salesforce Report. Suppose I have a product object with field product_name and quantity. Now I want to create a report that will get the total quantity of ...
2
votes
1answer
25 views

Querying distinct logins using LoginHistory and COUNT_DISTINCT

I seem to have run in to a SOQL error that I'm hoping someone has solved before. I am creating a dashboard for UserLogins using the LoginHistory object The query I am trying to run is: SELECT ...
0
votes
0answers
11 views

How do I find when a Custom Label was created or modified from API

How do I find when a Custom Label was created, modified, or who Created or Modified it from an API ? I have checked Partner WSDL, Metadata API and Tooling API but none of them give out this ...
0
votes
1answer
16 views

fetching values returned from SOQL query into map but map's id shouldn't be Id of soql

For example... I have a SOQL query :- [SELECT name, profile.name, email, isActive from User where UserRoleId in (SELECT ID from UserRole WHERE name in ('CEO','COO','ALC Midwest','ALC ...
0
votes
1answer
26 views

History in query

I am trying to get a list of reasons why clients were lost (absagegrund) this week. How would I go about this? Select o.Absagegrund1__c, (Select StageName, createddate From Histories) From ...
-1
votes
2answers
32 views

Nested queries with multiple objects

ust i am wondering why like this , and i know relationships are crazy many times in SFDC I have a query as below and getting results : select id,name,(select id,name from Batches__r)from ...
0
votes
1answer
32 views

Dynamic Query in Managed Package Salesforce

How can we write below dynamic query in managed package to pass Security review. set<id> idsList=new set<id>(); // list will have ids string query= 'select ...
0
votes
1answer
12 views

Grouping StageName history by CreatedDate

I am struggling with this query I am trying to do. I want to count how many times we went to a specific stage grouped by weeks. There is something very strange though, I can select count(stagename) ...
0
votes
0answers
7 views

Using SOQL to aggregate Email & Call Activity

I'm trying to write a SOQL query which aggregates Email + Call Activity for my companies Sales Team, but haven't been able to crack it yet. The final output should be something like the below: Date | ...
4
votes
1answer
70 views

How do I see query plan (explain) data for a given SOQL query?

Given any SOQL query (which for the sake of this question we can assume doesn't use apex bind variables), how can I determine things like what indexes (if any) are being used, and if the query is ...
1
vote
2answers
31 views

SOQL query with Dataloader using List Literal in WHERE Clause

Is it possible to construct a SOQL query with a list literal in the WHERE clause? My use case is that the data loader cannot handle child relationships/subqueries needed for my search, but I can get ...
2
votes
1answer
131 views

How to get data type of any object's field in SOQL

how to i get datatype of any filed in SOQL?
2
votes
1answer
29 views

SOQL query to pull cases that has openactivities

I am trying to pull list of cases in workbench that has open activities and my query is : SELECT Id, (SELECT Subject, Status, Priority, OwnerId FROM OpenActivities) FROM case The above query pulls ...
2
votes
2answers
103 views

SOQL Query to find if Open activities exist on case

Is there a way to return count(open activities) on case when I build a SOQL query in workbench ? Ex: SELECT Id, {count(open activities)} FROM Case WHERE AND Status = 'open' AND {open activities != ...
3
votes
1answer
18 views

How to add a search field to a drop down menu that filters the content?

I have a drop down menu that allows a user to select the product code, but my company has a lot of available products so I'd like to add a search field that queries the list while they type. any ...
2
votes
1answer
20 views

Why this strange behavior in the Salesforce debug logs? The query executed twice: 1 returng results and another one returng nothing

I am writing a trigger to update the child of a parent in case a specific field on the parent has changed. The problem is I get a query with 0 results. After looking on the debug logs, the SOQL ...
1
vote
3answers
76 views

Help with SOQL Lookup Relationship

Why is this statement wrong? I got an error when executing this statement in developer console. SELECT Id, Account_Name__r.Name, Account__r.Account_No__c From CBR__c CBR_ is a child object to ...
2
votes
2answers
211 views

isDeleted=True is not working in SOQL query

Wondering why this query will retrieve ZERO records when executed in Workbench and Developer console. (Though i have records in Recycle Bin) Select Id, IsDeleted FROM Account WHERE IsDeleted = TRUE ...
2
votes
2answers
30 views

SOQL/Javascript Button Questions to pull fields from parent objects

I am trying to create a custom button on a custom object which can only be clicked if a date on the parent object is filled in. I am new to SOQL and javascript but have managed to created custom ...
5
votes
2answers
34 views

How to exclude object attributes from REST API response?

My app performs the following SOQL query over REST API: SELECT Id FROM Opportunity WHERE IsClosed=True Instead of just returning the Id for each opportunity, the result is: { ...
2
votes
2answers
23 views

SOQL Optimization to reduce time consuming to execute query with OR Filter Condition

Please Suggest the approaches or help in optimizing the Logic/ Query to reduce time Consuming in executing the Order Object Query ( which is taking 10 minutes), this is effecting user experience ...
0
votes
1answer
25 views

Pull all the Contacts by Account name - SOQL

I'm trying to pull the Contact field by Account name and I'm sure the way I'm doing must not be the right way. my SOQL: Select AccountId,Id,FirstName,LastName,Email,Phone from Contact where ...
3
votes
1answer
17 views

How to get List of Opportunities with condition on OpportunityContactRole?

I would like to retrieve the list of Opportunities which have at least one OpportunityContactRole with role equal to test Right now, I am doing the below query but it retrieves all the rows in the ...
4
votes
1answer
118 views

SOQL returned data type

I have not been able to find exact answer on the developer pages, but from coding I am seeing that the only data type returned from a SOQL is a List. Is this correct? I am encountering this because I ...
1
vote
1answer
29 views

Group by: Combining two groups

I need help with this query. It returns me with 3 groups: Closed, Waiting and In progress. However I want to combine the Waiting and In progress groups to see the Closed vs not closed. How can I do ...
1
vote
1answer
27 views

Search value in big SOQL

I'm pretty new on apex. I'm writting an apex class to load a csv file and I need to process the data before to insert on a custom object, each record contains account's name but the field has to be ...
0
votes
2answers
29 views

Not able to fetch reference field data in SOQL

Here is my query: List<object1__c> lstRecords = [SELECT field1__c, field2__r.Name FROM Object1__c]; populateData((List<sObject>)lstRecords); //I need to pass sObject, since this function ...
3
votes
1answer
45 views

Force.com CLI bulk query returns nothing

I have submitted a simple query using the Force.com CLI like so: will@mint ~ $ force bulk query CallRecord__c "select Account__c, CallFlow__c from CallRecord__c" Query Submitted To retrieve query ...
1
vote
2answers
23 views

SOQL Select Statement within Select Statement in PHP

I have the following query: SELECT Name, Media_RO_Status__c, (SELECT OldValue, NewValue, CreatedById, CreatedDate FROM histories) FROM Registration_Object__c The response I get in php is: SObject ...
0
votes
0answers
16 views

Nested SOQL Query in PHP

I've the following SOQL query in PHP SELECT Id, Contact.Account.Name, CommunityNickname FROM User where CommunityNickname != '' That returns an sObject, however, when I try to retrieve the fields I ...
0
votes
1answer
21 views

Object Filter in SSIS Salesforce Source

I need to move all records from salesforce to a DWH using SSIS. After the initial run I need to move only the records that either got inserted or updated after the last run into SFDC. I learnt that ...
0
votes
1answer
29 views

Is there any query (SOQL, APEX) that we could run that would determine objects linked to inactive users

I am new to salesforce development Is there any way so that i can have all those objects(in case possible record too) linked to a user is having. How it is possible via apex or soql
2
votes
1answer
24 views

Put AggregateResult in Map

I'm trying to put my AggregateResult in a map so that I can reference it later in my code. trigger NoOfLiveProducts on Account (after insert, after Delete, after update) { map<Id,Integer> ...
1
vote
0answers
24 views

Deleting the values on account based on the related object [closed]

I have a custom object whenever a record is created it will update a custom_field__c value on Account. As a business request deleted some of the custom object records now they want to delete the value ...
2
votes
1answer
37 views

Is there anyway to prepopulate formula fields before saving?

I have a problem related to the UI in SalesForce because the input of other text number fields is based on the formula field results. IF a user input field Amount_To_Be_Paid is based on Formula field ...
2
votes
2answers
93 views

SObject row was retrieved via SOQL without querying the requested field on Contact.Account

I am getting this error: SObject row was retrieved via SOQL without querying the requested field: Contact.Account Controller: public class WrapperAccountCtrl { public List<Account> ...
3
votes
1answer
47 views

Search by '.' causes non-selective query exception

I have a simple query in an Apex trigger: SELECT Id, Name FROM Account WHERE Name in :Names where :Names is a set of strings Set<String> Names = new Set<String>(); This query fails ...