Tagged Questions

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

How to specify BatchSize in Rest API SOQL call?

How to specify BatchSize in Rest API SOQL call, I tried it as per salesforce documentation and its not working ? Note - I know you can do this using offset, but I wanted to explore if its possible ...
0
votes
1answer
17 views

Use CALENDAR_MONTH/CALENDAR_YEAR with Task.AtivityDate in SOQL Query

Need your help here. I'm building a calendar to show the Due Dates of my tasks by month. My query is this: SELECT Owner.Name, OwnerId, id, Subject, ActivityDate, Status FROM task WHERE ...
2
votes
2answers
66 views

How to Query what Salesforce SObjects a user has access to

Please suggest How to Query what Salesforce SObjects a user has access to ? Based on this i want to give access to user on particular apex tab menu . Thanks
0
votes
1answer
20 views

Unable to query Opportunity Contact Roles

I'm trying to get a list (and ultimately the ContactIds) of Contact Roles associated with an Opportunity in an after-update trigger, but the size of this list is always 0, even when there are Contact ...
0
votes
2answers
21 views

Displaying results of a nested SOQL query in Schema Explorer

I have two custom objects, Team (parent) and Player (child). I'm using Schema Explorer in the Force.com IDE to understand the data that exists in those objects. I tried the following simple query as a ...
1
vote
1answer
24 views

Querying from Multiple Objects

I've to Query a field(e.g X) from one object. Say I'm getting 20 records(LIST) Now, I've to Query another object using result of above Query using field X (X field is common to both objects but has ...
1
vote
1answer
21 views

SOQL on Rich text fields long text

I'm working on a custom search page, which will search through the fields of the Project object. I use dynamic SOQL query similar to that: SELECT Id, Name, Link_Test__c, ...
1
vote
1answer
12 views

Get Contact info and CampaignMember status in one query

Is there a way to retrieve contact information (first name, last name) and campaign member status for all members of a campaign in one SOQL query? I know you can get just the contact information with: ...
3
votes
2answers
115 views

Check for a picklist value using SOQL

I have the following SOQL and I only need values from Risk__Actions__r WHERE Risk__Status__c(Picklist) equals to 'Open'. But current way i'm doing displays an error. no viable alternative at ...
1
vote
1answer
33 views

Get Minimum Date from records fitting Specific where clause

Trying to get field with the earliest date from custom object. Here is my current query BomaGroups = [SELECT Name, Location__c FROM Group__c WHERE Location__c =:id]; // Selects the Group I want ...
0
votes
3answers
19 views

I need to find all the AccountID from Account where the Phone number does not start with '00'

I tried with this: SELECT AccountID FROM ACCOUNT WHERE NOT PHONE LIKE \'00%\' It's giving me error: "No viable alterative character "\" "
2
votes
1answer
26 views

SOQL Query returns results, however written in SOSL it returns nothing

I am trying to find contacts by Phone number. I require using SOSL due to it's search excluding non-alphanumeric chars but cannot get the same (or any) results from SOSL as I can from SOQL. I am using ...
2
votes
1answer
84 views

“Where” clause which removes alphanumeric characters?

I would like to write a query which searches based on a telephone number through SOAP API. In the clients SOQL DB the number could contain other string characters other than numbers such as: ...
1
vote
1answer
29 views

Why does upsert check lookup to determine duplicates rather than ID?

In a salesforce project, I have an object called Project__c which I want to upsert. I have recently added a lookup to the Project__c object and now when I do an upsert project, the following error ...
2
votes
1answer
55 views

SOQL query minimum Date in WHERE clause

trying to get field with the earliest date from custom object. Here is my current query BomaGroups = [SELECT Name, Location__c FROM Group__c WHERE Location__c =:id]; // Selects the Group I want ...
2
votes
2answers
23 views

SOQL order by desc of FAQ__VoteStat by NormalizedScore not returning results in the expected order

Problem description: The following SOQL query: [SELECT Id, ParentId, NormalizedScore, Channel FROM FAQ__VoteStat WHERE ParentId IN : knowledgeArticleIDs AND Channel =: channelName ORDER BY ...
1
vote
1answer
12 views

SOQL query to fetch incremental data hourly

I am using Jitterbit to confirgure data transfer to and fro my MySQL database. My requirement is such that I need to fetch newly created records from Salesforce into my database every hour. For this ...
2
votes
1answer
29 views

When is an autonumber generated?

I have a visualForce page that contains an object which has a autonumber as name. When the user presses save, the object is stored and I want the name to be populated with the name of the object. I'm ...
2
votes
1answer
43 views

How can I find all users with whom my custom object is shared?

I have a custom Salesforce Object whose records can be shared via a combination of sharing rules and manual sharing. I would like to create a List of User sObjects with access to the record. The ...
2
votes
1answer
17 views

SOQL error; problems with lookup to more than one contact?

I have a custom object, Session, with 4 similar lookup fields that all look up to contacts. The fields are: Teacher__c Teacher2__c Tutor1__c Tutor2__c In the Query Editor, the following SOQL ...
3
votes
0answers
35 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
33 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
36 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
42 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
25 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: ...
2
votes
1answer
23 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
318 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
41 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
31 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
18 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
47 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
32 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 ...
0
votes
1answer
43 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
78 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
29 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
111 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
48 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
39 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
59 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
31 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
22 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
35 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
181 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
28 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
30 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
38 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
263 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 ...