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

learn more… | top users | synonyms

5
votes
1answer
89 views

SOQL Query to Group By Month and Year

Need help with a SOQL Query. We are trying to pull our highest sales records by month and user. Looking to see something like: "John Doe 100 Sales May 2014. Currently I am getting the calendar month, ...
0
votes
2answers
33 views

Accounts without Opportinities SOQL Query

I have a requirement to query for master objects that have no corresponding detail objects. This would be similar to querying for Accounts with no Opportunities. In SQL I might do this: SELECT Id ...
1
vote
2answers
15 views

How to get the referenced field's name value when the field is referencing multiple types

I'm using v31.0 of the Salesforce REST API. When looking at the metadata for some of my objects, Salesforce says that the OwnerId field references two tables: Group and User. The JSON that Salesforce ...
1
vote
1answer
17 views

SOQL - how to group by CALENDAR_MONTH

I am trying to create a custom chart in a visualforce page. I am using the results of a SOQL query as my data for the chart. I have this SOQL query: SELECT CALENDAR_MONTH(Hire_Date__c) ...
4
votes
1answer
85 views

Filter results with not like

I have to query task object to get the rows with subject not starting with 'Email' . I have tried the given query. But it is not working . Please suggest. select status, subject, whatId from task ...
1
vote
1answer
16 views

Join Query to a Batch Handler and processing the result rows

Can we write a join query and pass on to a batch handler. Once I get all the rows, I want to dynamically fetch values using their fields described from the rows containing info of both the objects. ...
4
votes
1answer
43 views

SOQL query filter WHERE by month

I have a custom object having a Date field Expense__Date__c I need to perform a soql query on the custom object where Expense__Date__c = THIS_MONTH So my query looks like List<CustomObj__c> ...
2
votes
1answer
44 views

Soql on multiple dates

I want to query on the task for multiple dates eg, date d3 = system.today().addDays(3); Select Id, Subject, WhoID, ActivityDate, OwnerId from Task where IsClosed = False and ActivityDate ...
3
votes
1answer
47 views

How to mock a SOQL query in Apex

Our Apex unit (true integration) test run takes about an hour to complete (260+ individual unit tests) and this really slows down our dev process as we are trying to adhere to Continuous ...
2
votes
2answers
37 views

Query LeadSource from Task

I am trying to write a SOQL query that queries from Task the field LeadSource. In a report the name of the field that displays LeadSource is Contact/Lead. I have been trying different variations like ...
0
votes
2answers
25 views

Query Account field IsExcludedFromRealign

There is a field on Account called IsExcludedFromRealign which determines that if Account is excluded from Territory Assignment or not. I am having an issue where some of my accounts are not assigned ...
1
vote
2answers
68 views

Error in loop iteration: 'Loop must iterate over a collection type'

Please find my code here. trigger PM1 on Account (after update) { List<Product_Metrics_vod__c> toDelete = new List<Product_Metrics_vod__c>(); set<id> ...
0
votes
1answer
35 views

Not Queryable field issue

I have to query on a non-queryable field here. Can someone suggest a workaround for this? Please find my code below. trigger PM on Account (after update) { for ( Account acc : Trigger.New ) { ...
1
vote
2answers
96 views

After update trigger issue

Please find my code below. trigger PM on Account (after update) { for ( Account acc : Trigger.New ) { List<Product_Metrics_vod__c> listCon = [Select ...
1
vote
1answer
24 views

RecordType Query - Multiple OR statemetns

I am trying to make a query for a recordtype id where the developerName can be different values. I am getting error expecting right square bracket, found 'OR' Set<Id>oppRecTypeSet = [select id ...
3
votes
2answers
36 views

Query on Task.Phone?

It looks like querying Task 'phone' is NOT supported. Can anyone confirm? I can get Owner.Phone, but not read the phone field itself. Acc. to this doc: Phone Phone number of the contact or ...
7
votes
3answers
176 views

SOQL Multiple COUNT 's with different conditions

I have tried a bunch of different ways of getting a result about the age in only one query. I want to count the contacts that are between 20 to 29 years old and count in another column the contacts ...
4
votes
4answers
98 views

Trying to get a SOQL query with no duplicates

EDIT: Is there a way where I could just loop through my list and remove the duplicates? It should be easy but I've been having trouble with it. I have tried a bunch of different methods of getting ...
1
vote
1answer
18 views

Trigger Not Getting Parent Object field values

This is the data model in our implementation. Parent : Case Child : Case_Search_Worklog__c The following code snippet tries to set the Case_Search_Worklog__c.COWnerEmail with the email from the ...
1
vote
1answer
17 views

SOQL - Viewing Parent Object field

A fresher question. I am unable to view the data either in the developer console or in the Eclipse IDE for the following query. Parent : Case Child : Case_Search_Worklog__c SELECT ...
2
votes
1answer
16 views

soql query on selfserviceuser

I wanted to get name of account from selfserviceuser object however getting error, I used below query : Select contactid, contact.account.name from selfserviceuser; Any guess what am I doing wrong ...
3
votes
1answer
28 views

SOQL query with Multi Select Picklist in where clause

I am trying to build a query in Apex code to fetch all records where a multi select picklist has either of 2 values selected. When I build my query and string as option 1 it does not return back any ...
5
votes
1answer
90 views

Too many SOQL queries error when converting Leads

I am new here and have no coding experience whatsoever. I am a Salesforce admin with 3 years experience. Before I started at my current company, they hired a consultant to create some APEX triggers. ...
1
vote
1answer
27 views

Trying to use a SOQL result as an HTML div id in visualforce page

Answer: I figured it out (or at least worked around it). I used document.getElementById(researcher).show; instead of $$(researcher).each(function(element) element.show(); and it works perfectly now. ...
0
votes
1answer
20 views

how to retrieve data based on created date and group them

I need to query the child objects and group them based on contact and created date example. customobject records queried based on account - gets me 100 records unique contacts among 100 records - ...
2
votes
2answers
36 views

SOQL, how to return highly organized data

This may be a long shot, so bear with me. I have a query that returns a list of catagores (text strings) and a count of the number of times they occur: Order Request,7842 Request,3976 Other,3247 ... ...
1
vote
0answers
16 views

Field Mapping doesn't create all fields in CSV export

This is my SOQL query: SELECT Count(Id), Category__c FROM Case WHERE CreatedDate = THIS_MONTH GROUP BY ROLLUP (Category__c) ORDER BY Category__c DESC It works fine when using the DataLoader GUI, ...
1
vote
1answer
17 views

Write a trigger to add a new field on Account to have Name of all closed won opportunity separated by commas?

How to write a trigger to add a new field on Account to have Name of all closed won opportunity separated by commas?? I wrote the trigger but the functionality won't work. could anyone hlp in it??. ...
1
vote
1answer
42 views

SOQL Count distinct occurrences in column

I have to pull data from a Salesforce database and get a count of the number of times each category appears. Currently, I have it pulling a list of the categories and then I use a perl script to ...
0
votes
2answers
23 views

Trigger is not updating a lookup field

resolved. object sfid wasn't created yet, changed the trigger to after. I've looked at other posts, but for some reason cannot find a solution. Basically, when a new object is inserted into my ...
1
vote
1answer
105 views

SOQL results question

I know SOQL can only retrieve data. Now my question is, WITHOUT WRITING APEX, given that a query have 4 results. I know I can filter the results to 1 by limiting row and pretty sure this could be the ...
4
votes
2answers
61 views

Governor limit SOQL 101 being suppressed. How?

As far as I know, Governor limits can not be suppressed and will be shown to user on the UI. However I am facing below scenario where SOQL 101 limit is being logged into debug log and not being shown ...
2
votes
2answers
36 views

Approaching limit for non-selective query: How to find the offending query?

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
31 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
1answer
33 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
52 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
23 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
35 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
93 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
44 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
46 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
145 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
26 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
38 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
20 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
11 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
70 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
9 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
34 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.