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

regEx + search capability in sfdc platform

Looking for suggestions on accomplishing search + regEx in sfdc, to search cases which have occurrence of the phrase 'PROVIDED BY:' in case history and get the case number where this phrase was found ...
3
votes
1answer
23 views

Combining Filter with Where clause in Subquery is failing

I am trying to get the uncompleted tasks of every lead in a Lead View, when I try to get all the tasks it works fine, but when I add in the "where Status != 'Completed'" I get the following ...
0
votes
0answers
30 views

String literal or null placeholder in SOQL select clause

I am trying to run a query along the lines of this: SELECT Id, null as TextBody FROM EmailMessage or SELECT Id, '' as TextBody FROM EmailMessage Is there any way to include string literals in ...
2
votes
2answers
39 views

Why doesn't this query work?

Why doesn't this work? I get the error "MALFORMED QUERY" select AccountId, UserId from AccountTeamMember where Account.Id = AccountId and Account.OwnerId = UserId The following works no problem so ...
2
votes
0answers
20 views

Add variable to Object.query field

I understand that when doing SOQL queries with apex, you can add variables like so: [Select Id From Account Where Date = :date] But, for instance, I'm creating a pushtopic with a query like so: ...
1
vote
0answers
15 views

Performance impact of relationship queries in batch start

For a new batch process I have a choice between immediately selecting relevant records in the start function (but using several [field]__r comparisons as they are junction objects being queried) or ...
2
votes
2answers
305 views

What is wrong with my relationship?

I'm trying to use SOQL 'relationships' between two tables. I follow this example and it works fine: SELECT Account.Name, (SELECT Contact.Name FROM contacts) FROM Account from: ...
4
votes
2answers
37 views

Order Field by List in SOQL SELECT

I have an aggregate query on the Lead object. The query returns a list of Leads grouped by website (custom field) in a specific order based on a MAX of a date attribute. Say once we iterate through ...
0
votes
0answers
29 views

SOQL and SQL joins

Good Morning From what I can see joins are not available in the traditional sense with SOQL. I think I need to use "relationship". I have not had any success so far and want to confirm I'm going in ...
1
vote
3answers
37 views

Unit test for trigger SOQL query that is uncovered

I'm having an issue finishing up my unit test, and I think it is related to the SOQL query in my trigger. The trigger itself checks to see, upon Lead creation, if a Contact exists with a matching ...
0
votes
0answers
15 views

How to update the list of record in C#.net

I have integrated the salesforce in c# and i wan to update the record. but i got the error in the below code. List<account> accList= new List<account>(); for (int i = 0; i ...
2
votes
2answers
41 views

Why do I get this error: No such column 'AccountNumber' on entity 'Account'

I have seen a similar question asked/answered in multiple places. The gist of the answer is to rely on SOQL Polymorphism. But most examples don't start with with the Account Object, which as far as ...
2
votes
1answer
24 views

How to get the server timestamp through SOQL query or REST API?

This question was asked before, but the answer given was how to do it with Apex, and I am not using Apex: How to get the current timestamp using SOQL query? How do I do the equivalent of ...
1
vote
0answers
37 views

Following SQL WHERE clause in my pagination SQL

I have a custom object which is displayed on my visualforce page, the page can take url parameters which will alter the results filtering out types of records. The page also uses a custom controller ...
0
votes
1answer
39 views

List Opportunities that have a previous StageName [Advanced SOQL]

I'm trying to get a list of Opportunities that have now "Cancelled" (isClosed=true and isWon=false) stageName and the previous (Penultimate) value was "Active" by SOQL . For example, the Opp X had ...
2
votes
3answers
64 views

SOQL help with subquery where clause

I have a two tables, service order and a child table called status history (1 to M relationship). I am trying to find all service order's that have a status history record matching 'Order Complete'. ...
1
vote
1answer
23 views

Trying to display column from subquery/array

I am trying to display some columns in a datatable via my custom controller. The controller uses a SOQL query to retrieve the data. The query contains a subquery to recieve all rows in that subquery, ...
10
votes
1answer
107 views

How can adding a Subselect make a SOQL query non-selective?

I have a SOQL Query with subquery that fails to execute because it is non-selective. I don't understand why and cannot interpret the results. All I know is that tearing parent und sub query apart ...
1
vote
1answer
36 views

Getting error “System.LimitException: Too many query rows: 50001” what i do in this case.

i tried below resolutions but no any worked... REsolution: If your controller does not have any DML operation than you can easily solve above two salesforce governer limits using the attribute ...
3
votes
1answer
33 views

SOQL - group by getting 0 as key in result salesforce

I want to group by result using two fields. I achieved that by writing following query SELECT COUNT(Id) recordCount, av_Date__c, Type__c FROM Unvailability__c WHERE av_Date__c = ...
0
votes
4answers
36 views

How To Retrieve the Related List Data?

I have a Object called SiteContracts__c and it has a Related List Object is Engineer_CheckList__c", now I want to get the Engineer_CheckList__c record which is related to SiteContracts__c how can I ...
0
votes
3answers
51 views

System.LimitException: Too Many SOQL Queries: 101 in Trigger

Following is my trigger I get the following error System.LimitException: Too Many SOQL Queries: 101 in Trigger Here is my trigger trigger SubscriberUpdateTrigger on Subscriber__c (after Insert, ...
-2
votes
1answer
30 views

In below code in a map i am getting the id's and list of sobject id's.I have to make the query outside for loop. What is the solution for this?

Public class CustnCGJuncTriggerOperation{ //Method for "Frame Agreement" Creation on addition of "Customer" to "Customer Group". public static void ...
0
votes
1answer
20 views

How to query list of roles that has access to a Account record shared via sharing rule?

A sharing rule exists in Account which under certain criteria shares the record with a Role. Is there a way we can query AccountShare object or any other table to check what Roles are Accounts shared ...
4
votes
3answers
48 views

what is the best way of finding the execution time of SOQL query?

what is the best and reliable way to find the time taken by SOQL query to execute ? can we rely on SOQL_EXECUTE_BEGIN and SOQL_EXECUTE_END events in the debug log and compare their timestamps to get ...
3
votes
1answer
29 views

Javascript get field ids for URL

I'm trying to replicate the "New" button on a related list. The only difference is that, if a record of that type already exists, then it simple returns an alert. Otherwise the "New" activity should ...
5
votes
4answers
175 views

Looking for a Windows equivalent of SOQLExplorer

I need to be able to create SOQL on my windows Laptop, I am very used to SOQLExplorer on my Mac however this is not built for Windows. Is there an equivalent out there for Windows?
0
votes
0answers
18 views

AccountShare record not able to query with UserOrGroupId as filter, when rowcause is 'Rule'

Tried to query AccountShare record with UserOrGroupId as filter, this works good for all RowCause except 'Rule'. I tried to filter the above query with UserOrGroupId with RowCause as Owner, its ...
3
votes
1answer
27 views

Store/Search IP Addresses in a Custom Object

I needs to be able to store/search IP addresses/ranges for customers in a custom object so the addresses can be pushed to a third party system that grants access to a website via an institution's IP ...
0
votes
1answer
34 views

How can i display the result of the dynamic soql query

I have dynamic soql result in my apex code. The fields used for dynamic soql also been selected dynamically. I want to display the result on my VF page with the field name and value in it. My apex ...
10
votes
4answers
253 views

SOQL query to return records with numeric values

I'm trying to write a dynamic SOQL query to get an object's record that has numeric value in a particular field. I'm trying to do something similar like below: Account acc; queryString = 'SELECT ...
8
votes
2answers
41 views

Query Remote Site Setting?

Can we get all remote site settings in apex ? I would like to check if a remote site setting exists or not.
3
votes
1answer
42 views

map with List as value in SOQL

I'm working on a small project where a customer can be the master in a master-detail relationship to more than a single project object. Projects have a currency 'Max_Budget__c' and what I want to do ...
2
votes
1answer
30 views

How to count OpportunityLineItems left in an after delete OpportunityLineItems

I have a trigger on the OpportunityLineItem acting after delete. From that trigger, I want to query all the Opportunities associated to the OpportunityLineItems deleted to see if they still have other ...
2
votes
1answer
61 views

Testing Winter '15 - New Clause USING SCOPE values

I am trying to test "Using Scope" on a custom object, orders which has a MD relation to Account. I'm trying to filter a list view of Orders to show only by User's territory, like we have in Account ...
2
votes
1answer
37 views

Query a custom object's “__Share” in subquery

Is it possible to use a subquery to obtain a list of that object's __Share's? For example: ObjA has been manually shared via apex. At some point I may want to query information about ObjA and get a ...
0
votes
2answers
29 views

How can I mock a query of ApexClass for testing?

While recently working on a large project where unit test executions would run upwards of 2 hours, we realized we could get a performance gain by avoiding touching the database (e.g. SOQL and DML) ...
4
votes
2answers
179 views

How does one use the ? in a SOQL query?

According to the documentation here In a syntax statement, the question mark indicates the element preceding it is optional. You may omit the element or include one. I've never seen a SOQL ...
0
votes
1answer
10 views

Why is field ElapsedTimeInDays invalid in Apex, but works OK in raw SOQL query?

I am writing some Apex to query Approval processes. The following SOQL query runs just fine in Developer Console Query Editor: Select p.Id, p.ProcessInstanceId, p.ElapsedTimeInDays, p.ActorId, ...
2
votes
3answers
69 views

Retrieving more than 100.000 records using select statement

I have a custom object called equipment___c with more than 100.000 records, and also related to product object. To get product codes that are in equipment object, i used the following query: select ...
3
votes
1answer
79 views

Using the REST api to retrieve multiple objects with a single request

I'm trying to figure out how to best retrieve all of the ids returned by calling getUpdated. I'm using the REST API and I don't see anyway of retrieving a list of ids with a single request. ...
0
votes
2answers
39 views

How do I access custom fields of Task parent record using SOQL?

I have a custom object called Invoice that allows for Tasks/Events to be created for it. Using the SOQL query below, I am able to query on the Invoice objects standard Name field. SELECT What.Name ...
3
votes
1answer
21 views

Customer Portal and SOQL query optimization

We have a customer portal which has sharing set by Account i.e. Record level security by granting access to portal users where their Account matches the Account associated with the record. I was ...
3
votes
1answer
45 views

Invalid field Username on User : SOQL Query

I simply cannot understand the reason why I am getting this below error. 17:16:15.106 (1106785435)|SYSTEM_METHOD_EXIT|[29]|system.UserInfo.getUserId() 17:16:15.107 ...
1
vote
2answers
33 views

Query Plan tool in Developer Console showing index plan for custom field which is not indexed

I am trying to evaluate some of our SOQL queries using query plan tool in Developer Console. Query is on custom object and we don't have any custom index on any of the custom field of this object. ...
1
vote
0answers
25 views

fields required to create a task through Rest API in native android app

I am getting error 405 when trying to create a new task through the rest api in a native android app see 405 Error when Trying to Create Task through Rest API Now I am guessing it might depends on ...
0
votes
0answers
29 views

Can we query Library member permission and information about which type of permission member held?

Can we query Library(ContentVersion) member permission and information about which type of permission member held ? Manage Library Add Content Add Content on Behalf of Others Archive Content ...
1
vote
0answers
54 views

405 Error when Trying to Create Task through Rest API

I am trying to create a Task object through a RestRequest in a Native Android App (RestRequest.getRequestForCreate). The Problem is that I am getting 405 error Method Not Allowed What am I doing ...
2
votes
1answer
24 views

selected list should not get affected even if it is refreshed

I want to create a multiple select list, in this if user select a single/multiple records from it and refreshes or selects next/previous page of a list then selected records from list should remain ...
1
vote
2answers
43 views

Accessing the fields of Database.query() results

Database.query(query) returns sobjects. I want to access each fields in this sobject to check the value on each field. How is this done in controller?