Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
2answers
23 views

How to set the RecordTypeID

Im trying to set the RecordTypeId of a contact to a certain value if the contact was created by a specific user. Im getting the error: A value cannot be stored to RecordTypeId in type Contact. ...
2
votes
1answer
35 views

Which is more elegant/faster: Iterate over a large query result 25+ times or do 25+ queries?

NOTE: This is not an "opinion-based" question. I am asking a technical question about how the platform handles queries and memory. Please do not flag it. I want to display survey results using ...
0
votes
1answer
57 views

Count the number of details in master-detail relationship

How can I count the number of details in master-detail relationship? Let us suppose I have Detail_Type__c and Master_Type__c. Now if I have and Id of a Master_Type__c record I can do the following ...
0
votes
1answer
18 views

How to extract only profile.name and userrole.name corresponding to a particular User object

We have an existing Soql query SELECT Id,Username,LastName,FirstName FROM User we are trying to enhance this query to retrieve profile.name, userrole.name corresponding to each user as per How to ...
1
vote
1answer
9 views

How to find Queue Priority number?

Is there a way to query Queue priority? and I know you can find the Queue via soql: select Id from Group where Name = 'my group' and type = 'Queue'
0
votes
1answer
19 views

Sum up values(currency) from the list

Decimal totalReceived = 0.00; List<Money_Received__c> moneyReceived = [Select Amount_Received__c,Reservation__r.Total_Recieved__c from Money_Received__c where Id =: reservationId]; for(...
0
votes
1answer
32 views

Using Apex to find records in a list that match on certain fields

I have a question about looping over a list created from a SOQL query on Account. I need to find Accounts in the list that match on certain values and then update the matching Accounts. So far this is ...
-1
votes
1answer
21 views

Picklist related Query in salesforce

I Have a Picklist Field Like (Orderstatus__c) Field, Values are (A, B, C, D, E, F) This Picklist Field, when i am querying the Orderstatus__c Filed Those values will be displaying like Un order (B, E, ...
1
vote
2answers
28 views

How to omit the system fields when retrieving all fields for an object using Schema.getGlobalDescribe()?

I am creating a dynamic query by passing the object using Schema.getGlobalDescribe(). The result includes system fields that you cannot query (in workbench or query editor). Example: For contact ...
1
vote
2answers
47 views

What types of fields are groupable in a SOQL `GROUP BY` clause?

The Salesforce documentation is notably terse in describing Considerations When Using GROUP BY. The guidance provided for determining which fields can be grouped is simply: The Field object ...
0
votes
1answer
12 views

How to get the name of the relationship for inner queries in SOQL? [duplicate]

In Trailhead we have the query to get the Contacts for the Account named "SFDC Computing", with an inner query. SELECT Name, (SELECT LastName FROM Contacts) FROM Account WHERE Name = 'SFDC Computing'...
1
vote
1answer
86 views

Apex code to show records for whole week

I want to display the record of whole week according to the day I selected. Example: if i selected 15-08-2018 which is Wednesday, so i want the record from Monday to Sunday (13-08-2018 to 19-08-2018)....
2
votes
1answer
34 views

error thrown while trying to do a group by

I'm trying to write a query that gives me the name of users and the total number of ids assigned to them. Here I've Daily_Task__c a custom object with a lot of fields, here I'm trying to get the ...
2
votes
2answers
20 views

Distance between two places based on geolocation

I am trying to write a query to find contacts within a radius of 50 miles and here is the SOQL i have select Id,Name,mailingStreet,mailingState,mailingCity,mailingPostalCode,mailingcountry,...
1
vote
1answer
59 views

Set<sobject> doesn't maintain uniqueness although I am fetching Id field

I am trying to upsert a list of records and I may get duplicates so what I did In loop I am adding records to a set then that set into the list for DML. Now problem is coming when I add a record in ...
0
votes
1answer
19 views

Soql query that pulls Contacts from a custom Account Lookup field

We have a custom field on Opportunities called "Referring Account", which is a lookup field related to Accounts. Is it possible to run a query on Opportunities that pulls in every Contact associated ...
-1
votes
1answer
25 views

Unable to create cases through Apex InboundEmailhanlder

I'm trying to create cases through incoming email by using Apex Inbound Emailhandler. It worked very well for a sample class which pulls the contact id based on incoming email address and creates case....
0
votes
1answer
14 views

Counting Archived Tasks in a Flow

I have a flow that counts certain tasks based on their subject line. I am assuming that when the tasks are archived the flow will no longer count them via a fast lookup. Does anyone know of a ...
4
votes
1answer
58 views

SOQL Count() limits

Summer '18 changed Count() impact on query row limit from "number of records matched" to 1. Is there still some form of a limit, like selectivity criteria related limits, or can an arbitrary number ...
0
votes
1answer
23 views

DLRS Where Date 1 = Date 2 Error (expected colon received text)

I would like to have DLRS run a count on child records through a lookup. The where clause for counting is to compare a DATE field on the Lookup Parent to a Date/Time field on the Lookup Child. My ...
8
votes
1answer
39 views

Developer Console query on EventBusSubscriber returns only 1 row

This is too weird and just started happening within the last few days Execute this query in DC (V43 or V44) SELECT Id,LastError,Name,Position,Retries,Status,Tip FROM EventBusSubscriber In DC Only ...
0
votes
1answer
18 views

Getting child objects from parent

I have a Salesforce Parent child relationship. I need to get parent and child records from a Heroku app. Following is the SOQL. However partner stub does not have a way to get child records? Anyone ...
0
votes
1answer
21 views

SOQL query adding OR condition within IN statement

I have query that written something like this: I have data for both Schulz and Scholz List<User> usr = [SELECT Id, Name From User Where Name IN ('Schulz', 'Eric')]; The above query works fine....
1
vote
1answer
77 views

Is there a way to query Visualforce pages that have “Require CSRF protection on GET requests” set to false?

I'm working with an org that has hundreds of Visualforce pages, I've been manually checking this setting so far. Is there a better time-saving way to query visualforce pages that have this setting set ...
0
votes
1answer
37 views

Get all children that have same parent with one of the child's values

How can I get all children of the parent based off of one of the child's values? SELECT Feature__c, FeatureTwo__c FROM Child__c WHERE Parent__c IN (SELECT Parent__c.Id FROM Child__c WHERE ...
0
votes
1answer
21 views

Implementation restriction - How to query KB articles in different languages?

I have a few articles in different languages in SFDC, I would like to query all of them using a single query: When I try to save this line of code: FAQ__kav faqArticles = [SELECT VersionNumber FROM ...
0
votes
2answers
20 views

SOQL Query To Return Any Open Tasks Assigned To a User

As the title suggests, I'm simply trying to return a list of open tasks for a particular user so I can mass-change owner using Dataloader. I've worked my way to this query: SELECT Id, AccountId, ...
2
votes
2answers
47 views

SOQL search with LIKE

I’m very confused with the soql Like operator. If I have a record with a text field that may contain: "Orders to be shipped, pack blue labels/zip/ authorization slip needed.” And a user enters “blue ...
0
votes
0answers
53 views

SOQL on OpportunityContactRole in Trigger doesn't return any result in Lightning

I have a trigger on Opportunity object, which populates primary campaign source using a custom logic. As part of my logic, I am querying OpportunityContactRole in the trigger. The query gives result ...
0
votes
1answer
25 views

Invalid Bind expression type of <sobject> for id field SObject Account

I'm getting this error "Invalid Bind expression type of Class_Detail__c for id field SObject Account" Class_Detail__c.Student__c is a Master-Detail relationship field to Account. Basically I want to ...
0
votes
1answer
40 views

How to query ContentDocumentLink in SOQL and then upsert records in Data Loader

When querying ContentDocumentLink in SOQL using the following query, an error is thrown. Goal: We are attempting to get a spreadsheet of the data so we can update IsDeleted flag with TRUE on entries ...
0
votes
3answers
50 views

Query for Parent custom object and Standard child Object

I have a Parent custom object called New_Country_c and standard contact Object. I need to write a query to count of all contacts related to New_Country_c. I have tried following the query but does not ...
0
votes
1answer
21 views

Bulkify Apex class for event object using dynamic soql

I'm trying to get the name of whatId and WhoId on the event object onto a string. I can do it for a single record inside a for loop, the issue I see when Im looking to bulkify the code is that events ...
2
votes
0answers
29 views

getRecordTypeInfosByDeveloperName doesn't work with duplicate Developer names

Our product comes with a couple objects including RecordTypes. In our customer org I'm adding some RecordTypes and experienced, that I can give them names that the packaged types already have. So now ...
-1
votes
2answers
17 views

update the related list records using anonymous block

I have a requirement wherein an object account has 3 related list records as opportunity,accountplan and callreport. I want to update all three objects fields associated with the account. But getting ...
0
votes
1answer
33 views

1 level deep in a SOQL query

I can't choose my last file by record Id (this file was uploaded for this record). How can I do that by SOQL query? conVersion = [SELECT Id FROM ContentVersion WHERE (Select LinkedEntityId from ...
0
votes
2answers
21 views

SOAP connection and I have a query - Select from array of IDs via SOAP

I have a SOAP connection to SFDC in PHP and I have a query that looks like this: $query2 = " Select Name, StartDate from Campaign where Id in (7016F0000025iaJ, 7016F0000025iZV, 7016F000001PvKf)"; ...
0
votes
0answers
15 views

How to access JSONArray returned from query?

I'm using Salesforce Mobile SDK for Android for a native application. I'm having trouble accessing JSONObjects from a JSONArray. It seems that the JSONArray returned from my SmartStore object's query ...
-1
votes
2answers
42 views

Can we write SOQL query to fetch set the records which are in Trigger.New in before trigger? [closed]

Can we write SOQL query to fetch set the records which are in Trigger.New in before trigger
0
votes
1answer
23 views

Can't get record from controller to visualforce page

Visualforce page <apex:variable value="{!record.Reservation__c}" var="Client"> <p align="left" > full {!Client.Name} <br/> address{!Client....
0
votes
1answer
15 views

Why I am not getting empty field of type external Id, while fetching if from soql query?

Fetch empty text value of type external id using SOQL query in apex. I am using this query : Select id,name,CommentBody__c,CommentId__c,ParentId__c from Case_Comment__c where ParentId__c =:caseObj....
0
votes
1answer
21 views

How do we get Knowledge article Rating by SOAP api

In Knowledge Article, we getting all description about knowledge article by using "KnowledgeArticleVersion" but this API is not return rating of the article also likes and viewing the score. If ...
0
votes
1answer
30 views

SOQL is bringing users who are not visible to me

I have implemented a searchable drop-down using jquery and visual force. Whenever I start typing a string it will search the database and bring all the matched users. I am using a jquery to call a ...
6
votes
1answer
106 views

SOQL AggregateResult Query throws error: System.ListException: Row with null Id at index: 0

Background I have this Apex SOQL query: myMap = new Map<Id, AggregateResult>([SELECT OpportunityLineItemId, MIN(ScheduleDate) Starts ...
0
votes
0answers
15 views

FATAL_ERROR|Internal Salesforce.com Error updating a record list

I am getting the subjected error while executing an update on an Apex class. Basically I am trying to update a Decimal field and I am getting the error : @AuraEnabled public static void ...
0
votes
1answer
14 views

Selecting a hierarchy column from the same object

I have a query I've written for the Organization/Account object SELECT ID, Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, County__c, Phone, ParentId FROM Account This ...
0
votes
2answers
18 views

Updating 'multi select pick list' field, on many contacts, with different values

My situation is this: I have a custom object that has two custom text fields I need. Name of a list and client Id. Each client Id can be a part of more than one list. I then need to take this ...
6
votes
2answers
327 views

What is the difference between using the LIMIT clause and using a fixed index to retrieve data from a query?

This code recover the exact same account, I thought there could be differences with the way it ask the database ... Seems not to be the way it works, So an idea ? public static void ...
-1
votes
1answer
37 views

System.TypeException: Invalid date/time: 2018-09-18T16:57:37Z

I'm getting Invalid date/time: 2018-09-18T16:57:37Z in the developer console. please help me with this DateTime dt = Datetime.now().addMinutes(-10); String formatedDt = dt.formatGMT('yyyy-MM-dd\...
1
vote
0answers
26 views

SOQL “All Rows” on Bulk API alternative

I am required to retrieve all the records (including archived and deleted records) from a Salesforce object. I understand that this can be achieved using queryAll(). However, I have an environment ...