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

Warning email debugging

I am getting following warning email but can not find out where exactly the problem is. I am facing problem in finding out which SOQL query is causing issue. Any help will be much appreciated :) ...
2
votes
1answer
18 views

SOQL Query to count only Accounts with Opps in both this year and last year?

So rather than create an Apex class, run multiple queries then write some code to figure out the answer, I thought I'd take a stab at writing a complex query that would get me the answer I'm looking ...
1
vote
0answers
14 views

How to query a community with SOQL

To query my organization, I usually use this REST route. However, I receive records from both my organization and communities. I would like to scope my query to a specific community. I tried following ...
4
votes
1answer
37 views

Use a wildcard with the “IN” operator in a SOQL query [duplicate]

Essentially what I want to do is this: SELECT Id, Email FROM User WHERE Email in ('first.last1%','first.last2%') I am using this in a trigger and would like to come up with a query to match users ...
1
vote
1answer
20 views

Using the MVC, the Visualforce page times out when calculating discounts of large amount of Quotelineitems

I am using an MVC to calculate all discounts to valid products and display them out on a Visualforce page. The problem I encounter is if the Quote has over 500 quote line items, the MVC will finish ...
3
votes
2answers
33 views

Is it possible to get the “type” of object you're querying in a SOQL relationship query

For example, in the standard Salesforce Event object, I'd like to do the following with the WhatId field. select what.name, what.type(?) from event where id = 'myid' However, this will only work if ...
2
votes
1answer
86 views

Issue with passing multiple input values to Like clause in SOQL query. Any workaround please?

I am trying to run this query in Query Editor but got "Unknown error parsing query" Is there any workaround for this? Select Customer_Name__c From SAP_Customer_Master__c where ...
2
votes
2answers
48 views

Salesforce field alias

HI i am newer of sales force I was fired a quire select Name,(select Cou.firstname,Cou.lastName from contacts Cou) from Account Which display name of account and it's contact details associate ...
4
votes
2answers
37 views

Query returns Null in Apex code, but runs correctly in Execute Anonymous

This issue is tormenting me for several hours . I am trying to populate an AggregateResult list with the results of a query, but the query returns only nulls. The SAME CODE, run in Execute Anonymous, ...
1
vote
3answers
34 views

How to display an SOQL query in apex Datatable

I'm having a difficult time finding what (I think) should be a relatively simple procedure. I would like to create a class controller that returns a SOQL query and then display the results in an apex ...
4
votes
3answers
140 views

How do I mass update my object?

I have created a new number field within my Opportunities object which is set to required and has a default value (0), however this is causing issues with closed Opportunities that did not have the ...
1
vote
2answers
20 views

How do I use the SOQL IN keyword in the API? (C#)

I'm building something in which I get a list of parent objects, then would like to get a list of child objects whose parent account ID appears in the first list. Normally I would do something like: ...
2
votes
2answers
36 views

Query for ApexClass?

I'm trying to create a query where I want to search Apexclass and ApexPages . At present I'm able to search by Apex class,I'm trying to search for Apex class but did not worked.The object for class ...
1
vote
1answer
18 views

Filter by OwnerId is not working

I'm stucked with an issue. What is wanted is to filter search by Subject,Status,ActivityDate.It is filtering , now i want to filter by one more field "OwnerId" here.How do i go about this ? Any ...
1
vote
1answer
10 views

Apex UPDATE result is not visible by SELECT happening afterwards

A question to those who may have some background over Salesforce stack. I would like to confirm if my suspicions may be right. In APEX controller I'm doing following set of operations: setting ...
3
votes
1answer
57 views

Need Help for Salesforce SOQL for Get Record in Date Range

i need help for my SOQL. i have employee custom object with this information Employee table i want to select the employee information about total employee per department per month to date, for ...
0
votes
0answers
8 views

Is it possible to have auto populate table from another table in Salesforce?

I have one table structure like below.Actually I simplified the table to make it easier to explain. =) Year__c Column1 Colum2 FY2014 200 250 FY2014 150 1000 FY2014 81 123 FY2014 0 ...
1
vote
1answer
28 views

Visualforce: How to render multiple records, 1/page in a single PDF

I would like to render PDF page base on the amount of record I retrieve using SOQL. example If I have 10 invoice forms, I should be able to render 10 pages in 1 PDF.
2
votes
1answer
71 views

Export to excel file problem with displaying information

Following is my page <apex:page controller="contactquery" contentType="application/vnd.ms-excel#SalesForceExport.xls" cache="true"> <apex:pageBlock title="Export Results" > ...
2
votes
1answer
12 views

Query Opportunity join on Partner account lookup (Join two quries)

I have two queries, how can I join both together into one SOQL? SELECT o.Partner_Account__c, o.id, o.name, o.Account.Id, from Opportunity o SELECT a.id, a.name from account a where a.id = ...
2
votes
2answers
105 views

How can I query parent to child with two child values and no other child values?

I have one parent "quote__c" and child object "Quote_line_item__c" .I want get the parent id with query some thing like this select id,(select name from quote_line_item__c where name='123' and ...
2
votes
1answer
44 views

SOQL query DATE comparison

How do I compare a date field? I have 2 objects ObjectA and ObjectB and I would like to run a query for ObjectB that is DateFieldB = DateFieldA. Here is my Line: for(ObjectA__c A : Trigger.New) { ...
3
votes
2answers
98 views

Get parent records with 0 children in SOQL

So this would be possible with a roll-up summary, but since there's a limit on the number of these available, I'm trying to accomplish it without the roll-up summary field. Via SOQL I need to get a ...
0
votes
2answers
28 views

Replace SOQL query in for loop with method call?

I have a for loop structured in the following way: //MAIN CLASS for (List<My_Data__c> myData : [soql_query]) { code_block } Can I pull the soql query out of the loop, place it in another ...
1
vote
1answer
31 views

Timeout for soql in sandbox

I am trying to run a few queries on the Event object.But the queries time out. Querying the same in Full copy sandbox seems to be okay. But the time out happens in Production only. What could be the ...
4
votes
2answers
81 views

Apex CPU Time limit in Batch start() - is this a Query Timeout and how to cope with?

I have a Batch iterating over a large amount of records (with many fields) and 2 of their related child records. The start() method uses Dynamic SOQL to fetch them via QueryLocator to vary which ...
0
votes
1answer
34 views

Error in query for multiple fields

When i write 'Select Id, Subject,Status from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+'%\' Order By Subject,Status'; it is working but when i include OR ...
2
votes
1answer
24 views

How to check for existence of record?

I have the following piece of code: AccountMarket__c match = [select Id, Name, Account__r.Name, Market__r.Name from AccountMarket__c where ...
2
votes
1answer
20 views

Select with join Account and User table

first time I have needed to do a join in soql and I'm lost. in MySQL it would be Select AccountId, Account.ParentId, Account.Dealer_ID__c, User.Name FROM Account LEFT JOIN User on ...
2
votes
1answer
26 views

Query to find out duplicate records on two fields

I need to figure out the list of duplicate records based on two fields. That means suppose we have two duplicate records a and b, a.field_a__c = b.field_a__c and a.field_b__c = b.field_b__c and a.id ...
2
votes
1answer
29 views

Help needed getting set of child object IDs in a trigger

I have a set which I want to populate with child record ID's set <custom_object_name__c> ids = new set <custom_object_name__c>(); for (Opportunity opp : Trigger.new) ...
0
votes
3answers
42 views

One query to count # of Oppos Closed Won and # Closed Lost

How do i get this into one query ? I need to count total no of opportunities which are closed won and closed lost . Have written two queries and want to make it one with one variables . public ...
1
vote
2answers
28 views

Is this query correct?

Case oldRequestownerid=[SELECT OwnerId FROM case WHERE OwnerId =: Trigger.oldMap.get(d.Id).OwnerId ]; This query is written ...
2
votes
2answers
39 views

Optimize SOQL response time when Where clause references a formula field

I am creating a dashboard, and for example a Formula field will identify if the record has issues. I know that Formula fields are not indexed in SOQL. Can anybody tell what's the best approach in this ...
6
votes
2answers
37 views

Getting the right converted currency in SOQL

What is the right way to get the converted currency in SOQL? I've got this in my query: SELECT Owner.UserRole.Name, Id, Name, Include_in_Forecast__c, convertCurrency(Amount) FROM Opportunity ...
1
vote
0answers
13 views

Query the Partner Community Account via SOQL

I was updating test classes in our org to get more code coverage and stumbled upon all those obviously being for our partner community. Now there is this SiteRegisterController, which the Salesforce ...
0
votes
1answer
60 views

Constructor executing more than once

I am stuck and not able to find out why it is not working. My constructor is getting executed 5 times which is creating problem for me. <apex:page Controller="PrtnerMonthlyReport" sidebar="true" ...
1
vote
0answers
19 views

Knowledge Article Version not being retrieved through an SOQL on Site

I am trying to query the Knowledge Article Version object based on a list of Knowledge Article IDs that I have. The query seems to be working fine if I run it on the org or in the code, however when ...
0
votes
1answer
27 views

Getting SObject row was retrieved via SOQL without querying the requested field when trying to reassign approval request

I got the following error when trying to reassign the approval in the quote reassign approval request. SObject row was retrieved via SOQL without querying the requested field: ...
7
votes
0answers
124 views

Weird missing record issue with SOQL query

Can someone help me understand why this query is returning 1 less record than expected when a Date custom field (Due_Date__c) is included in the SELECT clause? As you can see in the screenshot, it's ...
3
votes
1answer
48 views

How to bulkify a trigger that has unrelated objects

I'm trying to bulkify a trigger, previously when I've done this there has been a relationship between the objects within the trigger and i've been able to figure it out from other peoples triggers. ...
0
votes
0answers
39 views

Unknown Exception. Too many Query rows

I have 3 SOQL Queries running in an Apex class. I'm using the related VF page in Force.com sites. When this code runs, it is throwing an exception on the page. No exception is caught in debug logs. ...
0
votes
1answer
31 views

SOQL Includes with Field Value?

I'd like to add a FROM Account WHERE Clients_for_Job_Opportunities__c INCLUDES (AVTRRT__Job__c.Account.Name) line to my SOQL query but at the moment it looks like I can only add static values. So ...
2
votes
1answer
64 views

SOQL done right. SOQL-Injection secure

I was looking for some reassurance that all that needs to be done (and its best practice) when doing dynamic SOQL is to use escapeSingleQuotes. There was a query like this string query = 'SELECT ' + ...
1
vote
1answer
41 views

How to accept InputField to filter a query and then display results

To save you a search, similar examples exist at how to pass value from visual force page (InputField) to controller? and ...
2
votes
1answer
44 views

validation rule to stop delete

I know this sounds a bit strange but I want to stop a deletion call so that I can test an error handler on my visualforce page. How can I go about setting up a validation rule that will stop a delete ...
2
votes
1answer
43 views

Non Selective Query issue

I m getting the following error in a trigger. Error:Apex trigger ContactSumTrigger caused an unexpected exception, contact your administrator: ContactSumTrigger: execution of AfterUpdate ...
4
votes
1answer
82 views

Can you do a SOQL Query on a Hierarchical Custom Setting?

I have a Hierarchical Custom Setting that I need to SOQL use a SOQL query for using the current User's Profile. Currently I'm using the getInstance() method with the User Profile ID to get the custom ...
0
votes
3answers
69 views

Unsure how to do this join

I can't fathom how to structure this query, by the end I want to be able to use the following without getting a null exception: for (Contract_Item__c cli : lineItems) { if ...
1
vote
3answers
44 views

Owner userRole name is not accessible

Heyy All, I was trying to pull the role name and tried following query - Select id, owner.userRole.Name from opportunity where stagename = 'closedWon' However when i try this simple query in ...