Skip to main content

Questions tagged [soql]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
929 views

Field Permissions History Query

I'm aware on how to run a query on FieldPermissions object to check the permissions for a specific field. The question I have, and I haven't been able to find anything online yet, is: If I run the ...
0 votes
1 answer
29 views

How to create a Map in apex to effectively bring soql outside loop for 2 objects manipulation

I have 2 objects , Account (look up to Acc landing) and Account Landing. Account landing has a field called accountid, which I need to update if the account has a acc landing associated to it. My ...
-1 votes
1 answer
39 views

OpportunityTrigger: System.LimitException: Too many SOQL queries: 101

I'm not sure if you can help. I'm just an admin, not a developer. but when I try and Mass Update using Dataloader, I get that error message. Wondering if anyone could fix it for me so I don't get that ...
13 votes
1 answer
23k views

Query Which Profiles Have Read Access To Specific Object?

Since I couldn't think of how to write this query off the top of my head, I thought it might be worth sharing. How can I query which Profiles have Read permission on a specific object? I knew it would ...
-1 votes
0 answers
21 views

SOQL outside of for loop [duplicate]

I have a simple method inside a trigger handler where I am working with 2 objects, and want to move the SOQL outside the for loop, please advise public static void beforeTrigger(List<...
0 votes
0 answers
33 views

SOQL query returns null field values for lookup fields when used by non admin users

I have a custom object with several custom lookup fields to other custom objects. I have a Apex class (not a trigger) that uses SOQL. And, when I traverse the lookup field and retrieve a field ...
0 votes
1 answer
150 views

How to access the translated DataCategoryName?

I'm using the following SOQL query to retrive the Data Category Name. SELECT Id, ParentId, Parent.Title, DataCategoryGroupName, DataCategoryName FROM Knowledge__DataCategorySelection WHERE Parent....
6 votes
1 answer
864 views

Unable to query with cross-Object pick-list field filter on Custom Metadata SOQL

I came across something weird, SOQL which has a filter as cross-Object picklist field doesn't return rows, even if records exist. Minimum viable code to replicate: Create a new custom metadata type, ...
8 votes
1 answer
1k views

What does Limits.getAggregateQueries() represent?

Per the Limits class documentation, there are a pair of methods for "aggregate queries": getAggregateQueries() Returns the number of aggregate queries that have been processed with any SOQL ...
1 vote
1 answer
2k views

How select all Data Categories with apex

How can I select all categories types in salesforce with apex?
3 votes
0 answers
47 views

Why doesn't ContentVersion Query doesn't respect OFFSET when you include VersionData?

I have some code where I have to be careful about how much ContentVersion data I load into memory at any particular time to avoid blowing the heap limit. I was planning to do an initial query on ...
1 vote
1 answer
55 views

SOQL Subquery error

I have 3 objects wich relate to themselves, they are: BRV_Carteira__c: Entity that specifies what can be sold to a client; BRV_CarteiraItem__c: The itens of the BRV_Carteira__c(Master-Detail) such as ...
0 votes
1 answer
42 views

Filter SetupAuditTrail query

The below query pulls in the records. I want to filter them to only see where an administrator logged in as another user. List<SetupAuditTrail> auditTrailList = [SELECT Id, CreatedDate, ...
2 votes
1 answer
68 views

Determining Flow Orchestration Version from a Flow Interview

I am trying to find a way to determine the running flow version of an orchestration using the Flow Interview Id. When looking at the Flow Interview page from Paused & Failed Flow Interviews I get ...
0 votes
1 answer
25 views

SOQL query to get Lead attributes from Account via converted account relation

I'm trying to get the Leads columns from the Account object. This is the type of query I want to run, but it doesn't work: SELECT Account.Name, (SELECT Name FROM Account.Leads) FROM Account If I ...
-2 votes
0 answers
42 views

How to retrieve a custom field from a standard object using SOQL

I am trying to retrieve a custom field from a standard object by using the code below, but I am not getting all the custom fields: Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType....
0 votes
1 answer
6k views

How to Filter Null Values inside SOQL query

I am trying to filter out the null values of Account Id related to the corresponding child contacts in the following query, but it is not happening. When I update the active__c checkbox field in the ...
3 votes
2 answers
1k views

How to get contentData and ContentFileName for FeedComment Post

Can anyone tell me how to get the contentData and contentFileName for FeedComment ? I can get same for FeedItem using below query. [select Id,RelatedRecordId,Type,Body,CreatedDate,CreatedBy....
0 votes
0 answers
16 views

Can I take the Omni-Channel current Status from a User to use on Another object?

Is there a way to reach the current Omni-Channel Status from Users so I can use in another object? Thanks in advance, Best regards, André Rödel.
-1 votes
0 answers
55 views

Cant get objects using SOQL Less-then a date

I have a custom fields, from date and to date. I want to create a SOQL to get objects within a specific date. That fall within the From Date and To Date. I can get From Date to work but I can't get ...
0 votes
1 answer
61 views

Didn't understand relationship 'UserOrGroup' in field path [duplicate]

I am querying the GroupMember object and inside my query I'm trying to get the related Email field value from the UserOrGroupId relational field, here is my query: SELECT Id, GroupId, Group.Name, ...
-1 votes
0 answers
17 views

How to fetch Email activities which is part of the contact?

I want to fetch the emails which are part of the activity of the contact. How do i fetch that? I am able to fetch the calendar event through Event object but not sure how to get the emails
0 votes
1 answer
1k views

insert & Database.insertImmediate not immediate?

Baffled by a new record I've added that isn't available to query. Person__c b = New Person__c(Name='Bob'); insert b; //Returns a ...
0 votes
1 answer
950 views

Fetch Accounts having more than 3 contact records in it in a single query

I want to Fetch all the accounts records(not the ids) that have 3 or more contacts present in a single query with contact records in it. I didn't find any reference of these. I had tried with some of ...
-1 votes
1 answer
56 views

Workbench SOQL - Aggregate Relationships not supported in Bulk Query

I am receiving error for the SOQL query I ran in Workbench for Bulk CSV: Failed: InvalidBatch : Failed to process query: FUNCTIONALITY_NOT_ENABLED: Aggregate Relationships not supported in Bulk Query ...
1 vote
1 answer
2k views

Simple Salesforce Query issues involving Malformed requests

I have a malformed query problem when using simple salesforce for my AWS python Lambda. The query uses the AccountContactRelation object. When an event is dropped into an AWS S3 bucket for taxonomy ...
0 votes
3 answers
2k views

How to do Nested Query In a Flow

There is already a related question Nested SOQL Query in a Flow. However it is unanswered and out of date, from more than 7 years ago. With all of the new capabilities of flows, I want to know if ...
0 votes
0 answers
48 views

Test Class Failure during deployment with tests due to SOQL on QueueSobject

Got an odd scenario where a test method fails during deployment due to the QueueSobject query not returning the expected queues. The original query is SELECT QueueId, Queue.DeveloperName, SobjectType ...
0 votes
1 answer
895 views

Content Document Parent ID Salesforce

I am completely lost on how to populate a ParentID for Content Documents. I would like to find the parent record (custom object record) linked to the Content Document. I have easily sorted it in the ...
2 votes
1 answer
1k views

Historical changes of the drop down list

I am trying to access the historical values for a drop-down-list custom field. From the GUI i know that it was changed on a specific date and currently it holds some value. But when i run a query ...
1 vote
1 answer
857 views

Clearing SOQL query cache for query performance testing

I'd like to do performance tests of the same SOQL query to check which order of WHERE and indexes configuration would be the fastest, but database caching makes it hard - after the first SOQL, the ...
0 votes
1 answer
46 views

Why am I able to see a lookup record's name field if I don't have access to the record

I have an Object A and that has a look up to an Object B. There is a record A1 in Object A and there is a record B1 in Object B. Record B1 is a lookup on A1. The user has access to record A1, but does ...
-2 votes
2 answers
676 views

NOT Like Operater is not working with dynamic SOQL [closed]

NOT LIKE Operator is not working with dynamic SOQL String searchQuery = 'SELECT Id, OwnerId, WhatId,Reminder_Date_Time__c, WhoId, Record_Type_Name__c, Task_Type__c,Assigned_Date__c, Task_Status__c, ...
0 votes
0 answers
37 views

Can't query record from ServiceResourceSkill object

I need to query record from object ServiceResourceSkill in apex class but system return no record event thought there're still records inside it. Here some informations: I ran this apex class by a ...
0 votes
1 answer
34 views

SOQL on FieldDefinition object - "LIKE" and "NOT LIKE" Return Same Results?

Somehow, these two logically opposing queries return (almost) the same data. How in the world do EntityDefinition.QualifiedApiName LIKE '%ChangeEvent%' and NOT EntityDefinition.QualifiedApiName LIKE '%...
17 votes
3 answers
95k 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'. ...
7 votes
1 answer
821 views

Query to UserRecordAccess for multiple record ids returns unpredictable results

I am using the query editor. Consider the following query: SELECT RecordId, HasDeleteAccess FROM UserRecordAccess WHERE UserId = '005J0000006QnWhIAK' AND RecordId IN ('00UJ000000AZUulMAH','...
3 votes
5 answers
8k views

Is there a way to report on attachments?

I've got a custom object that might have one or more attachments. I'm looking for a way to report on how many attachments there are on each record. I've done some research, and it looks like there's ...
3 votes
1 answer
57 views

Why does `EntityDefinitionId` works like SObjectType in following code?

Let's say I want to retrieve all the fields with master-detail for each objects for given PermSet. Why can we provide SObject type array instead of Ids? And how can I can retrieve SObjectType as well ...
5 votes
1 answer
114 views

How to write SOQL query to get accounts where billing city equals to shipping city in single query?

This question asked in interview. As per my knowledge, it's not possible to get in single query. Is it even possible? If yes, then how? Please answer this question. Thank You!
2 votes
3 answers
8k views

How to fetch contentNote records as per the contact record?

I am trying to fetch the note title, note body as per the related contact ID in one SOQL query as two SOQL queries won't serve the purpose. In contentNote, We have the note title and note body but ...
4 votes
1 answer
3k views

how to read all Content Notes saved as 'SNote' (Beta New Notes feature) for a Parent record all users?

I have been trying to read all New Notes (richtext version) via SOQL query in Apex Controller class. The design specifications for new notes signifies that they are stored in as ContentVersion ...
7 votes
1 answer
5k views

Entity 'ContentDocumentLink' is not supported for semi join inner selects

Why doesn't Salesforce support semi join selects on the ContentDocumentLink entity? Why would there be a random entity that doesn't work like all the others? This code: List<ContentVersion> ...
0 votes
0 answers
22 views

Will Large Data Volumes Affect the Performance of Custom and Activity Objects?

We plan to associate a custom object with the activity object to record the actions of our sales personnel. Based on our preliminary estimates, both the custom object and the activity object will ...
8 votes
1 answer
201 views

Picklist field returning values instead of API Names in SOQL after Summer '24 release in sandbox

We have a query in similar format SELECT COUNT(Id), toLabel(Picklist_Field__c) alias, Picklist_Field__c FROM Account WHERE Id = 'acct id' GROUP BY Picklist_Field__c ORDER BY Picklist_Field__c The ...
10 votes
2 answers
1k views

Field filter does not Work for Text Formula field used in SOQL

I have a simple SOQL query on Account which has a field Full_Address__c which is joint of Billing Street, City Zip. When I use this field as a filter it doesn't return the records: Example: String ...
3 votes
2 answers
652 views

Does Database.rollback on a savepoint release Select for Update locks

I'm trying to understand Salesforce's locking mechanism. I ran a test which does the following: Calls Database.setSavepoint(). Issues a Select for Update query. Calls Database.rollback(savepoint). ...
2 votes
1 answer
881 views

Calling a Visualforce Page from another and passing the ID

I have a visualforce page (a letter menu) that on the click of a button (downloads a PDF and saves a letter to the record): <apex:commandButton action="{!saveLetter}" value="Download Letter"/> ...
0 votes
1 answer
1k views

How to query the junction object related records inside the custom object

Hi i have a custom object object name Businesscase and it has a custom lookupfield to another object is Division.I have an junction object that has the two fields one is master detail of the ...
0 votes
1 answer
1k views

Deleting all public groups from Org

We have an utility which imports all data from one org to another, this results in creating public groups every time import operation is carried out. Is there any way we can perform delete operation ...

1
2 3 4 5
120